Skip to content

Conversation

@tim-richter
Copy link
Contributor

This rule applied to all th's on the page, because there was no specifier for the permutation table in front of it.

This made it so, storybook components that use th's also get that rule applied, which resulted in tables that were incorrectly styled.

This rule applied to all th's on the page, because there was no specifier for the permutation table in front of it.
@dongyunlee-daim
Copy link
Contributor

Thank you for your help with the project. However, I have a question within the commit and would like to ask you a further question. I see that you deleted the .permutation-inner-table selector, but as you can see in the link below, permutation-inner-table is another table that is created inside permutation-table. I'm wondering how removing this selector relates to the global style.

Also, I know the last patch fixed the issue you mentioned, but are you still experiencing styling issues? If so, could you please elaborate on that?

permutation-inner-table (line 92)

@tim-richter
Copy link
Contributor Author

Hey, sure.

We are still experiencing issues with that one CSS rule, because it gets applied to the story container (here)
Since the Wrapper is always the parent of a potential table the Css rule would be '.wrapper-class th', which actually matches all of the th's in our stories as well.

Since you applied the table#permutation-table specifier for all the other rules, those don't influence the stories, but this one rule was missing that specifier. So I added it.

You can see that a CSS rule is applied to a normal Table story with a th here:

Stackblitz Reproduction: https://stackblitz.com/edit/github-ypvo3z-eo1qm7?file=src%2Fstories%2FTable.jsx
If you inspect the 'I get styling injected' th element you can see the css rule being applied.

Screenshot:
image

@dongyunlee-daim
Copy link
Contributor

Merlin's beard! I misread your commit, I thought you were deleting an existing rule, not adding a new one.
Also, I thought I catched all exception, but I didn't 😱

Thanks for your help and sorry for your inconvenience.
I will apply this ASAP after sharing my team.

Once again, Thanks for your support!

}
table#permutation-table .permutation-inner-table td,
th {
table#permutation-table th {
Copy link
Contributor

Choose a reason for hiding this comment

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

To solve the issue with global styles, we've attached the id permutation-table to each table to prevent the styling of permutation-table from being applied to Stories that use the table element. However, this rule was excluded for <th> items.

After adding the rule and checking it, the styling was no longer injected into the Story.

GLFM 🤗

@dongyunlee-daim dongyunlee-daim merged commit f4f3f23 into daimresearch:main Sep 22, 2023
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.

2 participants