Skip to content

fix: snackbar: added lastfocusableElement prop #970

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

rmotwani-c-eightfold
Copy link
Contributor

@rmotwani-c-eightfold rmotwani-c-eightfold commented Mar 25, 2025

SUMMARY:

  • Added a prop lastFocusableElement which takes the reference of the element which triggers the snackbar
  • So that on close of the snackbar the focus correctly returns to the element that triggered it.

GITHUB ISSUE (Open Source Contributors)

NA

JIRA TASK (Eightfold Employees Only):

https://eightfoldai.atlassian.net/browse/ENG-133628

CHANGE TYPE:

  • Bugfix Pull Request
  • Feature Pull Request

TEST COVERAGE:

  • Tests for this change already exist
  • I have added unittests for this change

TEST PLAN:

  • pull branch down locally and start storybook (yarn storybook)
  • go to Snackbar
  • Set closable to true in the controls
  • Verify if focus goes to the close button on snackbar.
  • Verify if focus returns back to the element that triggered it.

case 1] snackbar triggerd when input is incorrect

Screen.Recording.2025-03-25.at.2.50.50.PM.mov

case2] snackbar triggered on button click.

Screen.Recording.2025-03-25.at.3.08.43.PM.mov

Copy link

codesandbox-ci bot commented Mar 25, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

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

Successfully merging this pull request may close these issues.

1 participant