Skip to content
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

Use dialog tags instead of div tags for sliders #1432

Open
trichoplax opened this issue Oct 15, 2024 · 0 comments
Open

Use dialog tags instead of div tags for sliders #1432

trichoplax opened this issue Oct 15, 2024 · 0 comments

Comments

@trichoplax
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently, focusing a text box in the Search slider (pop up box) requires JavaScript, because the HTML autofocus attribute only works for elements that are visible at page load, or that are inside a dialog tag.

Describe the solution you'd like
If we use dialog tags instead of div tags to contain the sliders, then the text box inside the Search slider simply needs an autofocus attribute to make it work, with no additional JavaScript beyond the JavaScript that makes the slider open and close.

However, this will require changing the JavaScript in the Co-Design repository that opens and closes sliders, as the autofocus will only trigger upon opening a slider if the slider (dialog element) is opened from JavaScript using .show(). This may conflict with the current approach, which involves adding and removing classes, so this may be a larger change than just the method call.

The file in Co-Design where the JavaScript controls the sliders is js_src/header.ts.

Letting the browser handle the autofocus rather than doing it ourselves in JavaScript will be faster, but it does not appear that the JavaScript delay is significant, or even noticeable, although it may be on slower machines. This probably makes this a low priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant