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

Give focus to modal buttons when clicked #5266

Open
laryn opened this issue Sep 30, 2021 · 4 comments
Open

Give focus to modal buttons when clicked #5266

laryn opened this issue Sep 30, 2021 · 4 comments

Comments

@laryn
Copy link
Contributor

laryn commented Sep 30, 2021

Description of the bug

(Pulled out from #4342 (comment))
If an off-screen field (e.g. node title) has focus when a modal button (e.g. "Select existing file" image library modal) is clicked, the page can jump in unexpected ways when the modal is closed. Perhaps we should give these types of buttons focus manually when they are clicked, to prevent this and anchor the page where it is.

@indigoxela
Copy link
Member

indigoxela commented Sep 30, 2021

This might make sense, but I didn't test much.

Another option could be to just remove the focus from other input fields when opening the library.
It's a bit odd on node forms that clicking on a CKEditor button (image/link) removes the focus from the title input (if it had it), but the image field button does not. 🤔

@klonos
Copy link
Member

klonos commented Oct 1, 2021

The focus should be moved to whichever input/button element was clicked 👍🏼 ...if that is not possible for some reason, then it makes sense to focus either on the parent element, or the element that comes before it (in the later case we may still have some jumping around, but it will be less then taking people to the top of the page).

My 2c.

@indigoxela
Copy link
Member

Are there other form items in Backdrop, that do not capture the focus when clicked?
Or is it only the image library button?

@klonos
Copy link
Member

klonos commented Oct 6, 2021

I can't think of anything else ta the moment @indigoxela ...the only similar issue I recall is with the token browser links when there are multiple token-enabled fields in the same form ...you need to manually select the field that you want the tokens to be added into, before opening the token browser. Not sure is that's still an issue or if we already fixed it though 🤷🏼

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

No branches or pull requests

3 participants