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

Make list type selector case sensitive #2418

Merged
merged 2 commits into from
Apr 6, 2023
Merged

Make list type selector case sensitive #2418

merged 2 commits into from
Apr 6, 2023

Conversation

simurai
Copy link
Contributor

@simurai simurai commented Apr 4, 2023

What are you trying to accomplish?

This is a follow-up to #2305 and closes #2406 by making the list type selector case sensitive.

Example code

<ol type="a">
    <li>Item 1
    <li>Item 2
</ol>

<ol type="A">
    <li>Item 1
    <li>Item 2
</ol>

rendered:

Before After
Screen Shot 2023-04-04 at 12 08 40 Screen Shot 2023-04-04 at 12 09 33

What approach did you choose and why?

The problem was that the ol[type='A'] selector overrides the ol[type='a'] since it comes after in the source order.

ol[type='a'] {
list-style-type: lower-alpha;
}
ol[type='A'] {
list-style-type: upper-alpha;
}

Adding s to the selector (ol[type='A' s]) makes it case sensitive, so the order doesn't matter anymore. Used this 👀 Codepen to test. Note that MDN says the case-sensitive modifier (s) is not widely supported yet, but tested in Chrome, Edge, Firefox, Safari and they all seem to work. Maybe the MDN table is just not updated yet? 🤔

What should reviewers focus on?

I was wondering why we even need these styles and couldn't just use the browser default. But I assume they are needed because we have some opinionated way when nesting lists:

ol ol,
ul ol {
list-style-type: lower-roman;
}
ul ul ol,
ul ol ol,
ol ul ol,
ol ol ol {
list-style-type: lower-alpha;
}

Can these changes ship as is?

  • Yes, this PR does not depend on additional changes. 🚢

@changeset-bot
Copy link

changeset-bot bot commented Apr 4, 2023

🦋 Changeset detected

Latest commit: de8ff0a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/css Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot temporarily deployed to Storybook Preview April 4, 2023 03:22 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview April 4, 2023 03:23 Inactive
@simurai simurai marked this pull request as ready for review April 4, 2023 03:29
@simurai simurai requested a review from a team as a code owner April 4, 2023 03:29
@simurai simurai requested a review from langermank April 4, 2023 03:29
@simurai simurai merged commit bce38de into main Apr 6, 2023
@simurai simurai deleted the fix-list-types branch April 6, 2023 03:03
@primer-css primer-css mentioned this pull request Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

list-style-type styles should use case-sensitive selectors
1 participant