-
Notifications
You must be signed in to change notification settings - Fork 26
DE54475 - Fix sticky list controls in dialog issue #3899
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
DE54475 - Fix sticky list controls in dialog issue #3899
Conversation
Thanks for the PR! 🎉 We've deployed an automatic preview for this PR - you can see your changes here:
|
Visual diff tests failed - pull request #3900 has been opened with the updated goldens. |
Co-authored-by: github-actions <[email protected]>
…ill be used in calc
If this looks ok, I'm still trying to get this in before branching. But if there's concerns, we can discuss pushing it or certfixing. It definitely felt like everything was against me trying to get this in 😩 |
@@ -37,6 +38,7 @@ export class ListControls extends SelectionControls { | |||
|
|||
const parent = findComposedAncestor(this.parentNode, node => node && node.tagName === 'D2L-LIST'); | |||
if (parent) this._extendSeparator = parent.hasAttribute('extend-separators'); | |||
if (this._extendSeparator) this.style.setProperty('--d2l-selection-controls-padding', '0px'); |
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.
Could this be put in the CSS inside of the .d2l-list-controls-extend-separator
block that's already defined?
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.
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.
I think that's my preference, to avoid setting CSS variables through JavaScript. But if that gets messy, this is fine.
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.
Ok, pushed that change. It's not quite as minimal as I'd like, I played around with different ways to get the names shorter but it always exposed a bit too much underlying knowledge of the selection controls
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.
Chatted with @dbatiste offline about this. We're going to go with the setting the variable in JavaScript for now. The other simple options felt a bit worse (reflecting a state property or passing classes in that exposed too much of how the underlying selection-controls
worked). We could go with a larger change to refactor the rendering of the controls, something like this:
render() {
return html`
<div class="extend-separators">this._render()</div>
`;
}
If we decide that's worth doing, that'll be a follow-up PR, keeping this one easier to backport.
* Add list visual-diffs and dialog demos to show the sticky list controls + scroll issue * Updating Visual Diff Goldens (#3882) Co-authored-by: github-actions <[email protected]> * Fix sticky d2l-list-controls width * Updating Visual Diff Goldens (#3900) Co-authored-by: github-actions <[email protected]> * Ignore length-zero-no-unit style linting rule for css variable that will be used in calc * Avoid having to set the css variable in Javascript * Revert Avoid having to set the css variable in Javascript --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <[email protected]> (cherry picked from commit 6b6501e)
🎉 This PR is included in version 2.139.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
) (This is a backport of #3899) * Add list visual-diffs and dialog demos to show the sticky list controls + scroll issue * Updating Visual Diff Goldens (#3882) Co-authored-by: github-actions <[email protected]> * Fix sticky d2l-list-controls width * Updating Visual Diff Goldens (#3900) Co-authored-by: github-actions <[email protected]> * Ignore length-zero-no-unit style linting rule for css variable that will be used in calc * Avoid having to set the css variable in Javascript * Revert Avoid having to set the css variable in Javascript --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <[email protected]> (cherry picked from commit 6b6501e)
I tried to set this up with
vdiff
s (both the old style which were super flaky and #3892), but I'm running into issues and I don't want to merge flaky tests. So for now, I've updated the demo pages for list and dialog and the list visual-diffs. dialog vdiffs will come later.The problem:

Lists jump outside of their own width 12px for their focus ring, and hover adds even a bit more with a shadow effect. We need to tell
selection-controls
to jump out as well to match, or else you can see the effects around it when scrolled:We are exposing this as a custom css property, with a default of
0
ford2l-selection-controls
. Thenlist
uses and exposes its own property, with a default of18px
padding. Dialog overrides this property so anyd2l-list-controls
inside will match its padding exactly (30px
default,20px
mobile,0px
forno-padding
mode).