question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Media Library: Reset state when losing focus

See original GitHub issue

Bug Description

If we open the media element dropdown menu from keyboard and then close it by pressing Esc key, the focus moves to the canvas but the media dropdown (3 dots) button keeps visible. ( See attached video )

Addition: pressing Esc doesn’t reset the element tabindex, so when someone tries to refocus the media element, it doesn’t start with the first element. ( See 2nd video )

Expected Behaviour

Pressing onEsc key either should refocus the media element, or it shouldn’t show the menu button when the focus gets moved to the canvas; plus it should reset the tabindex.

Steps to Reproduce

  1. Focus any media element
  2. Press Space key
  3. Press Esc key

Screenshots

https://user-images.githubusercontent.com/17360543/144904883-59c130f3-0a40-4b66-9cd4-ca0768a5145e.mov

https://user-images.githubusercontent.com/17360543/144904924-c9190aa2-9e3e-444f-9fec-57841ab6c490.mov

Additional Context

  • Plugin Version: 1.16.0-alpha.0
  • WordPress Version: 5.8.2
  • Operating System: macOS Monterey (M1)
  • Browser: Chrome

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
swissspidycommented, Mar 9, 2022

Hmm I suppose that makes sense 🤔

We can consult with a11y folks if this comes up again.

1reaction
miinacommented, Mar 9, 2022

At least that’s what I thought! I believe that’s how the roving tab index util and also custom navigation handlers are implemented currently. But perhaps it was always a bug, I just didn’t know.

I can create a general issue for it if it’s a bug – we’re using the same logic everywhere currently, in all library panes, in color picker, calendar, etc.

E.g. when I tab out of the library (or a group of colors in the color picker) and then click Shift + Tab to get back, I’d expect to jump back to where I was. If we’d reset the tab indexes when losing focus, I’d end up on the first element instead.

Thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return iPhone settings to their defaults - Apple Support
Go to Settings > General > Transfer or Reset iPhone > Reset. Choose an option: ... No data or media are deleted. Reset...
Read more >
React.js - input losing focus when rerendering - Stack Overflow
The reason input was losing focus in my case was due to the fact that I was re-rendering the input on state change....
Read more >
Allow newly uploaded files to be deleted from the media ...
Hover state of the remove buttons. Focus state: Focus state of the remove buttons. Message after removing an item: Message after removing an ......
Read more >
How to reset a TextInput field after a Screen is unfocused
Resetting an input field value when a screen loses its focus from being the current screen to another screen in the app is...
Read more >
Save UI states - Android Developers
Managing UI state: divide and conquer · Local persistence: Stores all the application data you don't want to lose if you open and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found