Improve accessibility of inline help tooltips#403
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| $(document).on('focusout', '.blc-field-help', function() { | ||
| var $wrapper = $(this).closest('.blc-field-help-wrapper'); | ||
| if (!$wrapper.length) { | ||
| return; | ||
| } | ||
|
|
||
| if (!nextTarget) { | ||
| window.setTimeout(function() { | ||
| if (!$openWrapper || !$openWrapper.length) { | ||
| return; | ||
| } | ||
|
|
||
| if (isElementAssociatedWithWrapper(document.activeElement, $openWrapper)) { | ||
| window.setTimeout(function() { | ||
| var activeElement = document.activeElement || null; | ||
| if (activeElement) { | ||
| var $active = $(activeElement); | ||
| if ($active.closest('.blc-field-help-wrapper').get(0) === $wrapper.get(0)) { | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| closeWrapper($openWrapper); | ||
| }, 0); | ||
| return; | ||
| } | ||
|
|
||
| closeWrapper($openWrapper); | ||
| closeWrapper($wrapper); | ||
| }, 0); |
There was a problem hiding this comment.
Preserve open tooltip tracking after blur of other help buttons
The new blur handler always closes the wrapper associated with the button that lost focus and unconditionally nulls $openWrapper. When a user tabs to one help button (without opening it) and then clicks another button to open its tooltip, the first button’s deferred blur runs after the second tooltip opens. Because closeWrapper($wrapper) is invoked for the unfocused button, $openWrapper is cleared while the newly opened tooltip remains visible. The document‐level click, focusin and Escape handlers rely on $openWrapper to dismiss tooltips, so the open tooltip can no longer be closed via those mechanisms and becomes stuck until the trigger is clicked again. Consider guarding the blur handler so it only closes the currently tracked wrapper.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68f0c3a29144832e94a27a032c3ba567