Skip to content

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

@codesandbox-ci
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.

@codecov
Copy link

codecov bot commented May 2, 2025

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.42%. Comparing base (7eeb006) to head (bfc3285).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/components/Snackbar/snack.ts 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #970      +/-   ##
==========================================
- Coverage   84.44%   84.42%   -0.02%     
==========================================
  Files        1104     1104              
  Lines       20613    20615       +2     
  Branches     7807     7809       +2     
==========================================
- Hits        17406    17405       -1     
- Misses       3119     3122       +3     
  Partials       88       88              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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