Repository navigation
feat(tour): hold a tour back while someone types - #919
Merged
Merged
Conversation
A tour opens 1.5 s after its page and driver.js takes focus, so a search, rename or note in progress lost the next key to the tour. If a text input, textarea or contenteditable editor has focus when the 1.5 s is up, or an IME composition is open, the tour now waits. It opens once focus has left the field and nothing has been pressed or clicked for another 1.5 s, which covers the pause before a person's next action. The wait runs on focus, key, pointer and composition events, not polling. A key press also restarts it, since a field removed by its own Enter can lose focus with no focusout. Fixes: #918
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.
Pull Request
Description
The dashboard, Recordings and transcript tours open 1.5 s after their page, and driver.js then takes focus. Someone already typing in the search box, a task or a note lost the next keys to the tour, and a typed space closed it.
useScheduledTournow opens a tour through a newwhenNotTypinghelper infrontend/src/lib/. When the 1.5 s is up and focus is in a text input, a textarea or a contenteditable editor (Tiptap's ProseMirror root included), or an IME composition is open, the tour waits. It opens once focus has left the field and nothing has been pressed or clicked for 1.5 s. The steps are still filtered when it opens. Leaving the page while it waits removes its listeners and timer and leaves it unseen for a later visit. #916's close handling and the transcript tour'srestoreTourPanelare unchanged.Decisions:
focusin,focusout,keydown,pointerdown,compositionstart,compositionend), with no polling. A key press also restarts it, because a field removed by its own Enter can lose focus without afocusout.compositionendcannot hold it for the rest of the visit.Fixes #918
Type of change
Checks run
python scripts/check.py(Ruff, format, whitespace and other gates, mypy, doc and Alembic validators, pytest)cd frontend && npm run lint && npm run check:contrast && npm run test && npm run buildcd site && npm ci && npm run buildpython3 scripts/validate_docs.pyAlso
check_whitespace.py,check_file_size.pyandgit diff --check. Full Vitest run: 310 files, 3391 tests passed. The 16 new cases inTourGuide.test.tsxfail against main'sTourGuide.tsx.whenNotTyping.test.tscovers the field checks, the IME hold, a field removed withoutfocusout, and that no listener or timer is left once it has run or been cancelled.Migration impact
python3 scripts/check_migrations.pyrun against a throwaway Postgres.Documentation impact
.github/CONTRIBUTING.md, "Documentation Ownership").Security impact
docs/SECURITY.mdboundaries preserved and updated where behaviour changed.Manual verification
Headless Chromium on a throwaway stack with made-up data and production builds of main and this branch, at 1440 px. For each tour, typing began 0.2 to 0.3 s after load, before the tour was due at about 1.7 to 1.9 s, and ran for 5 s at 120 ms a key. Then it rested 3 s in the field, and a click on empty page left the field. The dashboard has no sidebar search, so its run typed in the Add a task box. The recordings and transcript runs used the sidebar search.
Screenshots (if relevant)
None.