-
Notifications
You must be signed in to change notification settings - Fork 156
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
fix(sticky-header): prevent negative overscroll from hiding stuck elements #11266
fix(sticky-header): prevent negative overscroll from hiding stuck elements #11266
Conversation
…ments Safari in particular treats the bounce back from an overscrolled position as a scroll event. This can cause elements to be scrolled out of view when a user, for example, rapidly swipes to scroll to the top of the document.
Deploy preview created for package Built with commit: 7952797237f60e1da886d70e7af6bcfe7e579052 |
Deploy preview created for package Built with commit: 7952797237f60e1da886d70e7af6bcfe7e579052 |
Deploy preview created for package Built with commit: 7952797237f60e1da886d70e7af6bcfe7e579052 |
Deploy preview created for package Built with commit: 7952797237f60e1da886d70e7af6bcfe7e579052 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on iOS device and works perfectly.
This change needs to happen in both v1 and v2 (and masthead alpha) as close to concurrently as possible. The stickyheader is called by multiple components on load and we don't want to have to account for race conditions. |
51015ed
into
carbon-design-system:feat/masthead-v2-dev
…ments (carbon-design-system#11266) ### Description Safari treats the bounce back from an "overscrolled" position as a scroll event. This can cause elements to be scrolled out of view when a user, for example, rapidly swipes to scroll to the top of the document. https://github.com/carbon-design-system/carbon-for-ibm-dotcom/assets/12532727/097c055e-d039-4a9b-b23d-b8e5a2100da4 This PR fixes this interaction by limiting how far up the scroll is considered to be. This effectively ignores overscroll. https://github.com/carbon-design-system/carbon-for-ibm-dotcom/assets/12532727/344ffe1b-1354-4c3d-b485-e83039eb782c ### To test Visit the Web Components deploy preview's [Dotcom Shell With L1 story](https://ibmdotcom-webcomponents.s3.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/11266/index.html?path=/story/components-dotcom-shell--with-l-1) in Safari, and resize the window down to the mobile breakpoint. Scroll down the page until the L0 and L1 have disappeared above the viewport, then rapidly scroll to the top of the page. When the document "bounces" back into position, both the L0 and L1 should be visible. ### Changelog **Changed** - Prevents the bounce back when scrolling beyond the top of the document from hiding stuck elements above the viewport. <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
### Related Ticket(s) none ### Description We made some enhancements to the alpha v2 masthead after we'd integrated its branch into the main C4IBM v2 branch. This PR ports those enhancements over. - **fix(masthead-v2): use more explicit selector in dropdown toggle** (911f802) ([Original PR](#11084)) - **feat(masthead-v2): add masthead to document flow** (e1debd8) ([Original PR](#10998)) - **feat(masthead-v2): Minimize CMApp on megamenu open** (c4a06f3) ([Original PR](#11085)) - **fix(masthead-v2): do not fail if object data does not exist** (c9609f7) ([Original PR](#11205)) - **fix(masthead-v2): ensure L1 dropdown targets exist** (fc65086) ([Original PR](#11254)) - **fix(masthead-v2): provide accessible nav label** (f183d25) ([Original PR](#11269)) - **fix(sticky-header): prevent negative overscroll from hiding stuck elements** (51015ed) ([Original PR](#11266)) <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
…ments (carbon-design-system#11266) ### Description Safari treats the bounce back from an "overscrolled" position as a scroll event. This can cause elements to be scrolled out of view when a user, for example, rapidly swipes to scroll to the top of the document. https://github.com/carbon-design-system/carbon-for-ibm-dotcom/assets/12532727/097c055e-d039-4a9b-b23d-b8e5a2100da4 This PR fixes this interaction by limiting how far up the scroll is considered to be. This effectively ignores overscroll. https://github.com/carbon-design-system/carbon-for-ibm-dotcom/assets/12532727/344ffe1b-1354-4c3d-b485-e83039eb782c ### To test Visit the Web Components deploy preview's [Dotcom Shell With L1 story](https://ibmdotcom-webcomponents.s3.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/11266/index.html?path=/story/components-dotcom-shell--with-l-1) in Safari, and resize the window down to the mobile breakpoint. Scroll down the page until the L0 and L1 have disappeared above the viewport, then rapidly scroll to the top of the page. When the document "bounces" back into position, both the L0 and L1 should be visible. ### Changelog **Changed** - Prevents the bounce back when scrolling beyond the top of the document from hiding stuck elements above the viewport. <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
…ign-system#11183) none We made some enhancements to the alpha v2 masthead after we'd integrated its branch into the main C4IBM v2 branch. This PR ports those enhancements over. - **fix(masthead-v2): use more explicit selector in dropdown toggle** (911f802) ([Original PR](carbon-design-system#11084)) - **feat(masthead-v2): add masthead to document flow** (e1debd8) ([Original PR](carbon-design-system#10998)) - **feat(masthead-v2): Minimize CMApp on megamenu open** (c4a06f3) ([Original PR](carbon-design-system#11085)) - **fix(masthead-v2): do not fail if object data does not exist** (c9609f7) ([Original PR](carbon-design-system#11205)) - **fix(masthead-v2): ensure L1 dropdown targets exist** (fc65086) ([Original PR](carbon-design-system#11254)) - **fix(masthead-v2): provide accessible nav label** (f183d25) ([Original PR](carbon-design-system#11269)) - **fix(sticky-header): prevent negative overscroll from hiding stuck elements** (51015ed) ([Original PR](carbon-design-system#11266)) <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "test: e2e": Codesandbox examples and e2e integration tests --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
Description
Safari treats the bounce back from an "overscrolled" position as a scroll event. This can cause elements to be scrolled out of view when a user, for example, rapidly swipes to scroll to the top of the document.
Screen.Recording.2023-12-21.at.4.34.49.PM-480.mov
This PR fixes this interaction by limiting how far up the scroll is considered to be. This effectively ignores overscroll.
Screen.Recording.2023-12-21.at.4.40.06.PM-480.mov
To test
Visit the Web Components deploy preview's Dotcom Shell With L1 story in Safari, and resize the window down to the mobile breakpoint. Scroll down the page until the L0 and L1 have disappeared above the viewport, then rapidly scroll to the top of the page. When the document "bounces" back into position, both the L0 and L1 should be visible.
Changelog
Changed