-
-
Notifications
You must be signed in to change notification settings - Fork 165
Fix the Choices.js quirks by isolating it in a shadow root #8261
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
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
88a718c
remove Choices contao-component and install it as a npm package
m-vo d7f298e
move contao--color-scheme controller to the html element and allow ha…
m-vo b076c53
rewrite contao--choices controller with shadow isolation and refactor…
m-vo efdb4d1
fix filter layout
m-vo b564d49
build assets
m-vo bd80975
simplify import
m-vo 798f69a
allow defining a config value via a data attribute
m-vo f810e21
rename custom properties to a generic name
m-vo 1f938ea
build assets
m-vo f907a1d
fix border, remove unnecessary properties, reorder
m-vo f367ac8
normalize line height
m-vo 392cded
fix class name
m-vo 9adfc31
fix specificity
m-vo 087b59b
fix .is-open selector + simplify
m-vo d0fef2b
fix tl_search panel
m-vo 0a317ca
make this friendly for upstream merging by applying FC CS
m-vo 2b62096
build assets
m-vo
8000
Apr 23, 2025
a6c9c0b
Merge branch '5.5' into bugfix/isolated-choices
zoglo 4df465b
Add widths for the `shadow-root` instances for choices
zoglo 4ff6c23
Adjust the font-size for .choices list items
zoglo d166609
Only add margin to initialized choices controllers that are not withi…
zoglo 79205f6
Rebuild the assets
zoglo 193a026
Merge branch '5.5' into bugfix/isolated-choices
leofeyer 8f682e0
Rebuild the assets
leofeyer 7736f81
CS
leofeyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
@import "choices.js/public/assets/styles/choices.css"; | ||
|
||
.choices { | ||
display: inline-block; | ||
position: relative; | ||
width: 100%; | ||
height: 30px; | ||
font-size: 0.875rem; | ||
box-sizing: border-box; | ||
border: 1px solid var(--form-border); | ||
border-radius: 2px; | ||
background: var(--form-bg) | ||
url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNmE2YTZjIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Im02IDkgNiA2IDYtNiIvPjwvc3ZnPgo=") | ||
right -16px top 3px no-repeat; | ||
text-align: left; | ||
m-vo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
&:dir(rtl) { | ||
text-align: right; | ||
} | ||
|
||
&[disabled] { | ||
color: var(--form-text-disabled); | ||
background-color: var(--form-bg-disabled); | ||
border: 1px solid var(--form-border-disabled); | ||
cursor: not-allowed; | ||
} | ||
|
||
&:focus { | ||
outline: revert; | ||
} | ||
|
||
&.is-focused, | ||
&.is-open { | ||
z-index: 4; /* Higher z-index than tinymce and sticky-footer */ | ||
} | ||
|
||
.choices__inner { | ||
background-color: transparent; | ||
padding: 0; | ||
border: 0 none; | ||
border-radius: revert; | ||
min-height: unset; | ||
} | ||
|
||
.choices__input { | ||
background: transparent; | ||
padding: 3px 6px; | ||
margin: 0; | ||
width: auto; | ||
line-height: 17px; | ||
} | ||
m-vo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.choices__placeholder { | ||
opacity: 1; | ||
} | ||
|
||
.choices__heading { | ||
color: var(--text, #222); | ||
cursor: default; | ||
border: 0 none; | ||
padding: 3px 0 3px 6px; | ||
font-size: revert; | ||
} | ||
|
||
.choices__button { | ||
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMjIyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="); | ||
padding-bottom: 2px; | ||
border-left-color: var(--select-border) !important; | ||
} | ||
|
||
.choices__list--dropdown, | ||
.choices__list[aria-expanded] { | ||
background: var(--form-bg, #fff); | ||
border: 1px solid var(--form-border, #aaa); | ||
word-break: break-word; | ||
left: -1px; | ||
|
||
.choices__item, | ||
.choices__list:before { | ||
padding: 3px 6px; | ||
font-size: 13px; | ||
} | ||
|
||
.choices__item--selectable, | ||
.choices__list[aria-expanded] .choices__item--selectable { | ||
&.is-highlighted { | ||
background: var(--select-highlighted); | ||
color: #fff; | ||
} | ||
} | ||
} | ||
|
||
.choices__list { | ||
&:has(> .choices__group) > .choices__item { | ||
padding-left: 20px; | ||
} | ||
|
||
&[data-placeholder]:before { | ||
content: attr(data-placeholder); | ||
display: block; | ||
cursor: default; | ||
opacity: 0.7; | ||
padding: 3px 6px; | ||
font-size: 13px; | ||
} | ||
} | ||
|
||
/* Select one */ | ||
&[data-type="select-one"] { | ||
&::after { | ||
display: none; | ||
} | ||
|
||
.choices__item { | ||
overflow: hidden; | ||
white-space: nowrap; | ||
text-overflow: ellipsis; | ||
padding: 7px 0; | ||
} | ||
|
||
.choices__inner { | ||
padding: 0; | ||
|
||
&::after { | ||
content: ""; | ||
height: 12px; | ||
width: 12px; | ||
background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNmE2YTZjIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Im02IDkgNiA2IDYtNiIvPjwvc3ZnPgo=") | ||
center center no-repeat; | ||
position: absolute; | ||
right: 6px; | ||
top: 8px; | ||
transform: none; | ||
pointer-events: none; | ||
} | ||
|
||
&:dir(rtl)::after { | ||
left: 6px; | ||
right: auto; | ||
} | ||
|
||
.choices__list { | ||
box-sizing: border-box; | ||
padding: 0 22px 0 6px; | ||
|
||
&:dir(rtl) { | ||
padding: 0 6px 0 22px; | ||
} | ||
} | ||
} | ||
|
||
.choices__input { | ||
height: auto; | ||
padding: 3px 6px; | ||
border-bottom: 1px solid var(--form-border, #aaa); | ||
background: transparent; | ||
} | ||
m-vo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.choices__button { | ||
display: none; | ||
visibility: hidden; | ||
} | ||
|
||
&.is-open .choices__inner::after { | ||
margin-top: -0.5px; | ||
transform: rotate(180deg); | ||
} | ||
} | ||
|
||
/* Select multiple */ | ||
&[data-type="select-multiple"] { | ||
min-height: 30px; | ||
height: unset; | ||
|
||
.choices__inner .choices__item { | ||
border-radius: 2px; | ||
background-color: var(--select-bg); | ||
color: var(--text, #222); | ||
border: 1px solid var(--select-border); | ||
line-height: 16px; | ||
padding: 2px 6px 2px 6px; | ||
margin: 3px 0 3px 3px; | ||
position: relative; | ||
top: 0; | ||
word-break: revert; | ||
vertical-align: baseline; | ||
font-weight: inherit; | ||
} | ||
} | ||
m-vo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
/* Revert the cross in light mode */ | ||
:host([data-color-scheme="light"]) .choices { | ||
&[data-type="select-multiple"], | ||
&[data-type="select-on F438 e"] { | ||
.choices__button { | ||
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMjIyIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg=="); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.