carbon icon indicating copy to clipboard operation
carbon copied to clipboard

Focus trap in Dialogs is not working for React ^17.x

Open ivangonzalezsp opened this issue 3 years ago • 8 comments

Current behaviour

In a dialog when I use tab in my keyboard to move between the buttons inside the dialog it ends going to browser url and the buttons behind the dialog.

Expected behaviour

the focus is keep inside the dialog like in React 16

CodeSandbox or Storybook URL

https://codesandbox.io/s/optimistic-darkness-ek312?file=/src/index.js

JIRA Ticket (Sage Only)

XT-4739

Suggested Solution

No response

Carbon Version

102.9.0

What browsers are you seeing the problem on?

Chrome

What Operating System are you seeing the problem on?

MacOS

Anything else we should know?

No response

Confidentiality

  • [X] I confirm there is no confidential or commercially sensitive information included.

ivangonzalezsp avatar Jan 13 '22 11:01 ivangonzalezsp

FE-4752

DipperTheDan avatar Jan 18 '22 13:01 DipperTheDan

Hi @ivangonzalezsp We currently have a ticket open on our backlog to upgrade to React 17. We'll get this tested along side the upgrade to make sure this bug is resolved for you 😄

DipperTheDan avatar Jan 18 '22 13:01 DipperTheDan

Our upgrade to React 17 is currently blocked by an open issue on Enzyme. We are currently looking to migrate away from Enzyme.

nicktitchmarsh avatar Jan 19 '22 10:01 nicktitchmarsh

Hi there,

Any update on this issue? We just came across a blocking issue related to the version mismatch between 17 and 16.

Thanks

blaky avatar Mar 21 '22 16:03 blaky

@DipperTheDan @nicktitchmarsh, what's the status of this issue? Thank you!

shavonne-sage avatar May 12 '22 07:05 shavonne-sage

@ivangonzalezsp @shavonne-sage It looks like this issue does not exist anymore after updating the carbon-react package to the newest version https://codesandbox.io/s/winter-cdn-8l18bl?file=/src/index.js

mkrds avatar Jul 08 '22 13:07 mkrds

Thank you for letting us know, @mkrds .

shavonne-sage avatar Jul 13 '22 11:07 shavonne-sage

As @mkrds replied - the issue no more occurs, could you @shavonne-sage confirm that, thank you in advance?

DlgSHi avatar Jul 15 '22 06:07 DlgSHi

Hi @DlgSHi, Hi @mkrds,

Sorry for the long delay in getting back to you on this topic. I am currently looking into the issue on our side. I can confirm, that the dialog now works as expected. However, we still have a similar issue with the Sidebar component:

When we use the sidebar (even with the enableBackgroundUI prop set to false), the React extension claims to have a focus trap. However, via keyboard I can still Alt + Tab to the background content.

Can this issue be fixed in a similar fashion to the dialog focus? Should I open a new issue with you guys?

FYI: @shavonne-sage, @blaky, @ivangonzalezsp

Kind regards, Neville

nevillegallimore avatar Aug 22 '22 10:08 nevillegallimore

Closing as the issue is stale (should have been closed a while a go), we have upgraded to react 17 and focus trap works as expected

https://codesandbox.io/s/exciting-rumple-9lh7wt

edleeks87 avatar Sep 30 '22 16:09 edleeks87