Skip to content
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

Prevent scrollbar overflow in footer disclosures #1293

Merged
merged 2 commits into from
Feb 10, 2022
Merged

Conversation

kmeleta
Copy link
Contributor

@kmeleta kmeleta commented Jan 31, 2022

Why are these changes introduced?

Fixes #997

What approach did you take?

When the footer locale popups have corner radius, the scroll bar can overflow outside the popup. This is because the disclosure list is using overflow-y: auto. To keep the list scrollable but contain the content within the border radius I've wrapped the list in a new <div class="disclosure__list-wrapper"> element. This requires some minor changes to both the css and the js. disclosure__list-wrapper should now be the element concerned with the global setting styles and the visibility/positioning of the dialog on the page.

New pattern:

<button aria-expanded="false" aria-controls="MyList" aria-describedby="MyLabel">
<div class="disclosure__list-wrapper" hidden>
  <ul id="MyList" role="list"></ul>
</div>

Other considerations

I believe the changes to markup are safe and didn't notice any changes in the way VO announces the modified pattern, but flagging here in case this does affect expectations from an a11y perspective in some way.

Tip: Disabling whitespace during review will improve readability of these diffs.

Demo links

Checklist

@kmeleta kmeleta marked this pull request as ready for review January 31, 2022 20:00
@melissaperreault melissaperreault self-requested a review February 1, 2022 05:17
Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Ken! Made some observation that are not due to your PR I believe. Let me know if you would like me to create a new issue. 🙏

Otherwise, it looks good!
Tested:

  • Different settings range,
  • Different Color scheme
  • Safari, Chrome
  • No JS experience

No JS (Issue opened #1300)

  • The tertiary button style seems they have lost their styling (no border visible), even if border is set to 1 and 100% opacity.

Mobile (Issue opened #1301)

@kmeleta
Copy link
Contributor Author

kmeleta commented Feb 1, 2022

Thanks @melissaperreault I agree, definitely things to address. But maybe let's go ahead and make an issue to clean up all that stuff so it doesn't hold up this update.

@ludoboludo
Copy link
Contributor

The same happens to the cart note I believe but since it's going to need a different approach it most likely should be a different issue/PR.
It's also kind of an edge case since it only comes up if you write a lot of info in the cart note: screenshot

@kmeleta
Copy link
Contributor Author

kmeleta commented Feb 1, 2022

The same happens to the cart note I believe but since it's going to need a different approach it most likely should be a different issue/PR. It's also kind of an edge case since it only comes up if you write a lot of info in the cart note: screenshot

Hmm yeah I remember that, guess we never logged that in the same issue. But I just did a quick audit and it's also going to be an issue with the textarea on blogs and contact. I was gonna throw that in, but I'm not sure what approach to use for it, given an overflow: hidden would also hide the focus border animation 🤔 Let's plan to handle separately for now. cc @ludoboludo

ludoboludo
ludoboludo previously approved these changes Feb 4, 2022
Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me when testing and voice over was clear when navigating it.

Just the one thing is maybe a bit more spacing to fully display the focus ring.

Copy link
Contributor

@sofiamatulis sofiamatulis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 Just noticed a few things when playing with the global settings

overflow-y: auto;
font-size: 1.4rem;
padding-bottom: 0.5rem;
padding-top: 0.5rem;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also an issue on cart note:

https://screenshot.click/10-33-0n390-e7xaj.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm considering the text area issue separately because it's more complex.

The same happens to the cart note I believe but since it's going to need a different approach it most likely should be a different issue/PR. It's also kind of an edge case since it only comes up if you write a lot of info in the cart note: screenshot

Hmm yeah I remember that, guess we never logged that in the same issue. But I just did a quick audit and it's also going to be an issue with the textarea on blogs and contact. I was gonna throw that in, but I'm not sure what approach to use for it, given an overflow: hidden would also hide the focus border animation 🤔 Let's plan to handle separately for now. cc ludoboludo

min-width: 12rem;
width: max-content;
}

.disclosure__item {
position: relative;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we add corner radius, the scrollbar gets a bit cut off: https://screenshot.click/10-34-vbl98-jvwxu.mp4

Copy link
Contributor Author

@kmeleta kmeleta Feb 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing we can do about that with this approach (the solution specifically aims to mask the scrollbar). The only other possible solution (that I see anyway) to is just give the scrollable list enough margin so it stays away from the corners (which is kinda ugly).

Copy link
Contributor

@melissaperreault melissaperreault Feb 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am aligned that we can live with the tradeoff of cutting it off. Merchant would have other ways to go around this like reducing the border thickness and roundness if they have long list of currency/country. Very edge case!

@sofiamatulis sofiamatulis self-assigned this Feb 10, 2022
Copy link
Contributor

@melissaperreault melissaperreault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 🚢

@kmeleta kmeleta requested a review from sofiamatulis February 10, 2022 17:47
Copy link
Contributor

@sofiamatulis sofiamatulis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 🎉 🚢

@kmeleta kmeleta merged commit ad989e6 into main Feb 10, 2022
@kmeleta kmeleta deleted the disclosure-radius-fix branch February 10, 2022 19:39
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Prevent scrollbar overflow in footer disclosures

* Add scroll padding
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.

[Global setting] Fix scrollbar and corner radius relationship
4 participants