segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.38k stars 830 forks source link

Add shouldAutoFocus prop to Overlay, SideSheet, and Dialog components #1535

Closed brandongregoryscott closed 1 year ago

brandongregoryscott commented 1 year ago

Resolves #1404

Overview

This PR introduces a prop to Overlay, SideSheet and Dialog that allows a consumer to disable the default autofocus behavior that lives in Overlay.js. As noted in that task, there are certain cases where the behavior can be incorrect or undesirable but there's no obvious way to opt out of it. This PR addresses that - retaining the current behavior, but opening up a way to disable it if needed.

Screenshots (if applicable)

Behavior can be demoed in the respective Storybook areas:

https://deploy-preview-1535--evergreen-storybook.netlify.app/?path=/story/overlay--autofocus-disabled

https://deploy-preview-1535--evergreen-storybook.netlify.app/?path=/story/side-sheet--autofocus-disabled

(Scroll to bottom and click button 'Show Dialog with autofocus disabled') https://deploy-preview-1535--evergreen-storybook.netlify.app/?path=/story/dialog--dialog

Documentation

netlify[bot] commented 1 year ago

Deploy Preview for evergreen-storybook ready!

Name Link
Latest commit ad68171c79efac080bc20d33149d67c4ff06a9a1
Latest deploy log https://app.netlify.com/sites/evergreen-storybook/deploys/6358219c67c38200085bf457
Deploy Preview https://deploy-preview-1535--evergreen-storybook.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.