Skip to content

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

Merged
merged 11 commits into from
Aug 21, 2023

Conversation

svanherk
Copy link
Contributor

@svanherk svanherk commented Aug 17, 2023

I tried to set this up with vdiffs (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:
image

We are exposing this as a custom css property, with a default of 0 for d2l-selection-controls. Then list uses and exposes its own property, with a default of 18px padding. Dialog overrides this property so any d2l-list-controls inside will match its padding exactly (30px default, 20px mobile, 0px for no-padding mode).

@github-actions
Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://pr-3899-brightspace-ui-core.d2l.dev/

Note
The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

@github-actions
Copy link
Contributor

Visual diff tests failed - pull request #3900 has been opened with the updated goldens.

@svanherk svanherk marked this pull request as ready for review August 17, 2023 20:50
@svanherk svanherk requested a review from a team as a code owner August 17, 2023 20:50
@svanherk
Copy link
Contributor Author

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');
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That only gets added to the section, but I also need it on the div that acts as the shadow:
image

But if we like that general pattern better, I could create a new class that gets added to both spots?

Copy link
Contributor

@dbatiste dbatiste Aug 18, 2023

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@svanherk svanherk merged commit 6b6501e into main Aug 21, 2023
@svanherk svanherk deleted the DE54475_Fix_sticky_list-controls_in_dialog_issue branch August 21, 2023 14:15
svanherk added a commit that referenced this pull request Aug 21, 2023
* 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)
@ghost
Copy link

ghost commented Aug 21, 2023

🎉 This PR is included in version 2.139.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Aug 21, 2023
svanherk added a commit that referenced this pull request Aug 21, 2023
)

(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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants