cauldron icon indicating copy to clipboard operation
cauldron copied to clipboard

fix(react): makes LoaderOverlay focusOnInitialRender work

Open tbusillo opened this issue 2 years ago • 1 comments

closes: https://github.com/dequelabs/cauldron/issues/747

Summary

  • Removes overlayRef.current as a dependency and forcing of focus only triggers when the component initially mounts.
  • Removes the setTimeout that wrapped overlayRef.current.focus(), which previously existed due to the focus indicator styling not appearing on the focused element (it was a timing/race condition).
  • Updates tests/docs.

tbusillo avatar Nov 26 '22 17:11 tbusillo

Preview branch generated at https://fix-loader-overlay--autofocus.d1gko6en628vir.amplifyapp.com

github-actions[bot] avatar Nov 26 '22 17:11 github-actions[bot]

Sorry for the delay on this @tbusillo but is this something you want to try to get up to date on or just defer?

scurker avatar May 08 '24 21:05 scurker

Sorry for the delay on this @tbusillo but is this something you want to try to get up to date on or just defer?

@scurker I'd be open to doing it. Is the original issue still valid/have there been any changes to the requirement(s), outside of converting test coverage maybe?

tbusillo avatar May 09 '24 00:05 tbusillo

@scurker I'd be open to doing it. Is the original issue still valid/have there been any changes to the requirement(s), outside of converting test coverage maybe?

Yes, I believe it's still valid. useEffecting off of a ref isn't really super reliable.

scurker avatar May 09 '24 16:05 scurker

@scurker I'd be open to doing it. Is the original issue still valid/have there been any changes to the requirement(s), outside of converting test coverage maybe?

Yes, I believe it's still valid. useEffecting off of a ref isn't really super reliable.

IIRC, this originally had to be done due to animation timing(s) causing the active element to be the loader, but the UI not painting the focus indicator.

I am not sure what changed (could be any number of things) but I don’t mind cleaning this up and finishing it when I get some down time.

tbusillo avatar May 09 '24 21:05 tbusillo

Closed in favor of https://github.com/dequelabs/cauldron/pull/1486.

tbusillo avatar May 20 '24 06:05 tbusillo