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

Simplify "hide skipped rules" implementation #658

Merged
merged 2 commits into from Dec 13, 2023

Conversation

bluekeyes
Copy link
Member

@bluekeyes bluekeyes commented Dec 9, 2023

It's always bothered me that the "hide skipped rules" toggle had to remove elements from the DOM to hide them so that the :last-child selector would work. This was fine when the toggle was off by default, but became a problem once we switched it to default on: skipped rules appear and then suddenly disappear once the DOM loads and the script runs.

The new version does all of the hiding with CSS rules, so the JS toggle only flips an attribute value instead adding or removing nodes. While this needed a bit of server support in the template, it should make the loading experience better and the toggle faster with large policies. And because the tree is otherwise static, there's no disadvantage to attaching extra information for styling in the template.

This is going to conflict with #656, but I'll fix whichever one merges second.

It's always bothered me that the "hide skipped rules" toggle had to
remove elements from the DOM to hide them so that the :last-child
selector would work. This was fine when the toggle was off by default,
but became a problem once we switched it to default on: skipped rules
appear and then suddenly disappear once the DOM loads and the script
runs.

The new version does all of the hiding with CSS rules, so the JS toggle
only flips an attribute value instead adding or removing nodes. While
this needed a bit of server support in the template, it should make the
loading experience better and the toggle faster with large policies. And
because the tree is otherwise static, there's no disadvantage to
attaching extra information for styling in the template.
@@ -30,12 +30,12 @@ details summary > * {
@apply pl-4;
}

.tree > li {
.tree .node {
Copy link
Member Author

Choose a reason for hiding this comment

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

Had to remove the child combinator to make the top-level skipped / not skipped attribute rules work, which then required switching to a class to not mess up other list items by accident.

@bluekeyes bluekeyes requested a review from a team December 9, 2023 03:52
jamestoyer
jamestoyer previously approved these changes Dec 11, 2023
@policy-bot policy-bot bot dismissed jamestoyer’s stale review December 12, 2023 21:03

Invalidated by push of 90f9f67

@bluekeyes bluekeyes merged commit fe8278e into develop Dec 13, 2023
7 checks passed
@bluekeyes bluekeyes deleted the bkeyes/skipped-filter branch December 13, 2023 16:56
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.

None yet

3 participants