Skip to content

feat: Add more ephemeral overrides for drop-downs. #9086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

BenHenning
Copy link
Contributor

@BenHenning BenHenning commented May 22, 2025

The basics

The details

Resolves

Fixes #9078
Fixes part of #8915 (new tests)

Proposed Changes

Exposes the ability to disable ephemeral focus management for drop-down divs that are shown using showPositionedByBlock or showPositionedByField. Previously, this was only supported via show, but the former methods are also used externally.

This allows the underlying issue reported by #9078 to be fixed downstream for cases when both the widget and drop-down divs are opened simultaneously.

This PR also introduces tab indexes for both widget and drop-down divs (which were noticed missing when adding tests). This is because, currently, taking ephemeral focus on for a node that doesn't have a tab index will do nothing. This fix is useful for future screen reader work, and doesn't have obvious impacts on existing core or keyboard navigation behaviors (per testing and reasoning).

Reason for Changes

Exposing the ability to disable ephemeral focus management for all public API entrypoints for showing the divs is crucial for providing the maximum flexibility when downstream apps use both the widget and drop-down divs together. This should ensure that all of these cases can be correctly managed in the same way as google/blockly-samples#2521.

Test Coverage

This introduces a bunch of new tests that were missing originally for both widget and drop-down div (including specifically verifying ephemeral focus). As part of the drop-down div tests, it also introduces actual positioning logic. This isn't great, but it's somewhat reasonable and robust against page changes (since the actual mocha results can move where the elements will end up on the page).

These changes have also been manually tested with both the core simple playground and the keyboard experiment plugin's test environment with no noticed regressions in either. The plugin's tests have also been run against these changes to ensure no new breakages have been introduced.

Documentation

No documentation changes beyond the code ones introduced in this PR should be needed.

Additional Information

The new tests may actually act as a basis for avoiding the test backdoor that's used today for the positioning tests for drop-down div tests. This doesn't replace those existing tests nor does it cover other behaviors and entrypoints that would be worth testing, but testing ephemeral focus is a nice improvement (especially in the context of what this PR is fixing).

@github-actions github-actions bot added the PR: feature Adds a feature label May 22, 2025
@BenHenning BenHenning marked this pull request as ready for review May 22, 2025 22:32
@BenHenning BenHenning requested a review from a team as a code owner May 22, 2025 22:32
@BenHenning BenHenning requested a review from gonfunko May 22, 2025 22:32
@github-actions github-actions bot added PR: feature Adds a feature and removed PR: feature Adds a feature labels May 22, 2025
@github-actions github-actions bot added the PR: feature Adds a feature label May 22, 2025
Copy link
Contributor Author

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Self-review (spot check). I could add some comments for the tab indexes, but I won't bother unless other changes end up being needed.

@BenHenning BenHenning merged commit 056aaf3 into google:develop May 22, 2025
14 checks passed
@BenHenning BenHenning deleted the expose-better-ephemeral-control-for-dropdown-div branch May 22, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add manageEphemeralFocus parameter to dropdown show functions
3 participants