Repository navigation
Show the virtual keyboard in assignments - #51
Merged
Merged
Conversation
Every document's viewer was given addVirtualKeyboard={false}, and the
addVirtualKeyboard prop of ActivityViewer was accepted but never used,
so an assignment had no Doenet virtual keyboard. On a touch device a
math input also keeps the device's own keyboard down, which left readers
on an iPad with no keyboard at all.
addVirtualKeyboard now reaches each document's viewer, defaulting to
true. The viewers share a single keyboard tray on the page.
Bump the version to 0.1.0-alpha-19, and bring the version recorded in
package-lock.json, which still said alpha-17, up to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks done
The keyboard tray takes its styles from @doenet/doenetml-iframe's stylesheet, which the host page has to import. Now that the keyboard is on by default, the dev app showed the tray's keys unstyled at the end of the page, since it never imported that stylesheet. Import it there, and say in the README that a host page needs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused prop-forwarding change has regression coverage, and no blocking issues were identified.
No open issues 🎉
What changed in this PR
Restores the shared Doenet virtual keyboard in assignments by forwarding addVirtualKeyboard to each document viewer.
Changes:
- Enables the keyboard by default while preserving explicit opt-out.
- Adds regression tests and stylesheet setup guidance.
- Updates package versions to
0.1.0-alpha-19.
| File | Description |
|---|---|
| test/cypress/component/ActivityViewer.virtualKeyboard.cy.tsx | Tests shared-tray behavior and opt-out. |
| src/Viewer/Viewer.tsx | Forwards the keyboard setting to activities. |
| src/Activity/SingleDocActivity.tsx | Passes the setting to DoenetViewer. |
| src/Activity/Activity.tsx | Declares the shared keyboard option. |
| README.md | Documents required styles and opt-out. |
| package.json | Bumps the release version. |
| package-lock.json | Synchronizes release versions. |
| dev/main.tsx | Imports keyboard styles for development. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Assignments on doenet.org show no Doenet virtual keyboard. On an iPad, math inputs get no keyboard at all, because DoenetML keeps the device's own keyboard down on touch devices so it won't compete with the Doenet keyboard. Example: https://doenet.org/activityViewer/3VTecFFh2wLPoVrf4bh91i
The cause is in this package.
SingleDocActivitypassedaddVirtualKeyboard={false}to every document'sDoenetViewer, andVieweraccepted anaddVirtualKeyboardprop without using it, so nothing could turn the keyboard on.Changes
addVirtualKeyboardnow goesActivityViewer→Viewer→Activity→SingleDocActivity→DoenetViewer, defaulting totrue. Each viewer's iframe wrapper registers with one tray shared by the whole page, so an assignment of many documents still shows a single keyboard.ActivityViewer.virtualKeyboard.cy.tsx: a two-document sequence shows exactly one tray by default, and none withaddVirtualKeyboard={false}. With the old hard-codedfalserestored, the default case fails.@doenet/doenetml-iframe/style.css, which the host page must import (doenet.org already does). The dev app now imports it, and the README says a host needs it; without it the tray's keys appear unstyled at the end of the page.0.1.0-alpha-19. The version recorded inpackage-lock.jsonstill saidalpha-17, so it is brought up to match.This works with the current
@doenet/doenetml-iframe0.7.24, so no DoenetML upgrade is needed. The companion PR Doenet/DoenetML#2287 handles the other half: a host that does turn the keyboard off will no longer take away the device's keyboard too.Test plan
ActivityViewer.virtualKeyboard.cy.tsxpasses, and fails against the old behaviornpm run build, eslint🤖 Generated with Claude Code