fix: make tutor chat close X actually close the panel#10
Merged
Conversation
Root cause: .tutor-chat__panel sets `display: flex`, which has the same
specificity as the UA stylesheet's `[hidden] { display: none }` rule.
Because author stylesheets win cascade ties over UA, the `hidden`
attribute was a no-op and the panel never actually hid when the X was
clicked.
Changes
- tutor-chat.css: add `.tutor-chat__panel[hidden] { display: none }` so
the hidden attribute reliably hides the panel; bump panel z-index to
61 so it is unambiguously above the FAB (both were 60).
- tutor-chat.js: add `type="button"` to FAB and close to keep behavior
predictable; make the close SVG non-interactive (pointer-events="none",
focusable="false") so the click target is always the button; call
preventDefault on both, and stopPropagation on the close click.
- index.html + sw.js: bump cache-busting versions so the SW picks up the
fixed assets.
- tests: two new static checks asserting the regression cannot return:
the [hidden] CSS rule must be present, and the close button must be
wired with toggle(false, ...).
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
.tutor-chat__panel { display: flex }has the same specificity as the UA stylesheet rule[hidden] { display: none }. Because author stylesheets win cascade ties over UA, thehiddenattribute was a no-op and toggling it never actually hid the panel.display: nonefor.tutor-chat__panel[hidden], hardens the close button wiring (type=button, non-interactive SVG,preventDefault+stopPropagation), and bumps the panel z-index plus cache-bust versions so the service worker picks up the fixed assets.Files changed
frontend/tutor-chat.css— add[hidden]override; bump panel z-index 60 → 61.frontend/tutor-chat.js—type=buttonon FAB/close,pointer-events="none"on the close SVG,preventDefault/stopPropagationon handlers.frontend/index.html— bumptutor-chat.cssandtutor-chat.jsversion query strings.frontend/sw.js— bumpCACHE_VERSIONso the service worker re-fetches the updated shell.backend/tests/test_frontend_integration.py— two new regression checks (CSS[hidden]rule and close-button wiring).Test plan
node --checkon every file infrontend/*.js(matches CI's frontend job).pytest -qinbackend/— all 91 tests pass, including the 2 new regression checks.