Skip to content

Keep the device's keyboard when a viewer has no virtual keyboard - #2287

Merged
dqnykamp merged 1 commit into
Doenet:mainfrom
dqnykamp:system-keyboard-without-virtual-keyboard
Oct 19, 2026
Merged

dqnykamp merged 1 commit into
Doenet:mainfrom
dqnykamp:system-keyboard-without-virtual-keyboard

Conversation

@dqnykamp

@dqnykamp dqnykamp commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

On a touch device, a math input sets inputmode="none" on its textarea so the device's own keyboard won't compete with the Doenet virtual keyboard (#1695). It did this even when the viewer was embedded with addVirtualKeyboard={false}. In that case there is no Doenet keyboard, so the reader had no keyboard at all.

That is what happened in assignments on doenet.org, where the assignment viewer turned the virtual keyboard off (a separate fix there is open as Doenet/assignment-viewer#51). This PR makes DoenetML fail safe on its own, whatever the host does.

The other host that passes addVirtualKeyboard={false} today is doenet.org's single-document embed page (/embed/:viewId). Its math inputs on a touch device will raise the device's keyboard once a document there renders with a DoenetML release that includes this change. That embed goes through doenetml-iframe, which loads the DoenetML version the document asks for. No host was found that turns the Doenet keyboard off and relies on the device's keyboard staying down.

Changes

  • doenetml.tsx: a new VirtualKeyboardAvailableContext, provided by WrapWithKeyboard with the value of addVirtualKeyboard. Inside a doenetml-iframe, the inner viewer receives the host's addVirtualKeyboard, so the value is correct there too. The context defaults to false, so a math input rendered outside a viewer never suppresses the device's keyboard.
  • mathInput.tsx: the device's keyboard is suppressed only when a virtual keyboard is available, the pointer is coarse, and the reader hasn't asked for the system keyboard.
  • test-cypress: the test app accepts an addVirtualKeyboard message, so a spec can turn the keyboard off.
  • New spec accessibility/mathInputSystemKeyboard.cy.js emulates a touch device. It checks that the textarea's inputMode is none when the virtual keyboard is present and text when it is absent. The second test fails without the mathInput.tsx change.

Test plan

  • mathInputSystemKeyboard.cy.js passes, and fails without the fix
  • tagSpecific/mathinput.cy.js, accessibility/virtualKeyboardTouchTargets.cy.js, accessibility/mathInputAriaLabelledby.cy.js

🤖 Generated with Claude Code

On a touch device a math input sets inputmode="none" so the device's
keyboard does not compete with the Doenet virtual keyboard. It did so
even when the viewer was embedded with addVirtualKeyboard={false},
leaving the reader with no keyboard at all. That is what readers on an
iPad hit in problem sets on doenet.org, whose assignment viewer turns
the virtual keyboard off.

The viewer now tells its math inputs whether it has a virtual keyboard,
and they suppress the device's keyboard only when it does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix has regression coverage for both configurations, with no unresolved review findings.

No open issues 🎉

What changed in this PR

Preserves the device keyboard for touch users when a DoenetML viewer has no virtual keyboard.

Changes:

  • Shares virtual-keyboard availability with math inputs.
  • Adds regression coverage for both keyboard configurations.
  • Includes patch release notes for affected packages.

🤖 Generated with GitHub Copilot

File Description
packages/​test-cypress/​src/​CypressTest.tsx Allows tests to disable the virtual keyboard.
packages/​test-cypress/​cypress/​e2e/​accessibility/​mathInputSystemKeyboard.cy.js Checks touch-device input modes with and without a virtual keyboard.
packages/​doenetml/​src/​Viewer/​renderers/​mathInput.tsx Suppresses the device keyboard only when a virtual keyboard is available.
packages/​doenetml/​src/​doenetml.tsx Provides virtual-keyboard availability through context.
.changeset/​system-keyboard-without-virtual-keyboard.md Documents the fix for affected packages.

Review effort: Balanced

@dqnykamp
dqnykamp merged commit d650b12 into Doenet:main Oct 19, 2026
49 of 50 checks passed
@dqnykamp
dqnykamp deleted the system-keyboard-without-virtual-keyboard branch October 19, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants