Skip to content

Commit f2ff867

Browse files
asyncLizcopybara-github
authored andcommitted
fix: remove :host-context rtl selectors
We can support this now that Chrome 120-121 are stable. PiperOrigin-RevId: 606984234
1 parent 6589b2e commit f2ff867

File tree

4 files changed

+7
-50
lines changed

4 files changed

+7
-50
lines changed

docs/support.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Current browsers and versions supported:
2828

2929
Browser | Version
3030
------- | -------
31-
Chrome | 112 +
32-
Edge | 112 +
31+
Chrome | 120 +
32+
Edge | 120 +
3333
Firefox | 119 +
3434
Safari* | 16.4 +
3535

field/internal/_outlined-field.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,17 +324,6 @@ $_md-sys-motion: tokens.md-sys-motion-values();
324324
inset-inline-start: var(--_focus-outline-width);
325325
}
326326

327-
// TODO(https://bugs.chromium.org/p/chromium/issues/detail?id=1420655):
328-
// remove :host and :host-context once Chrome supports :dir
329-
:host-context([dir='rtl']),
330-
:host([dir='rtl']) {
331-
.resizable .container {
332-
clip-path: inset(
333-
var(--_focus-outline-width) var(--_focus-outline-width) 0 0
334-
);
335-
}
336-
}
337-
338327
.resizable .container:dir(rtl) {
339328
clip-path: inset(
340329
var(--_focus-outline-width) var(--_focus-outline-width) 0 0

progress/internal/_linear-progress.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,6 @@ $_indeterminate-duration: 2s;
171171
calc($_indeterminate-duration * 2);
172172
}
173173

174-
// TODO(https://bugs.chromium.org/p/chromium/issues/detail?id=1420655):
175-
// remove :host and :host-context once Chrome supports :dir
176-
:host-context([dir='rtl']),
177-
:host([dir='rtl']) {
178-
transform: scale(-1);
179-
}
180-
181174
:host(:dir(rtl)) {
182175
transform: scale(-1);
183176
}

slider/internal/_slider.scss

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ $_md-sys-shape: tokens.md-sys-shape-values();
201201
}
202202

203203
// rtl for active track clipping
204-
@include _get-rtl-selectors('.track', '::after') {
204+
.track:dir(rtl)::after {
205205
clip-path: inset(0 $_active-track-start-clip 0 $_active-track-end-clip);
206206
}
207207

208-
@include _get-rtl-selectors('.tickmarks', '::after') {
208+
.tickmarks:dir(rtl)::after {
209209
clip-path: inset(0 $_active-track-start-clip 0 $_active-track-end-clip);
210210
}
211211

@@ -440,7 +440,7 @@ $_md-sys-shape: tokens.md-sys-shape-values();
440440
}
441441

442442
// in 'rtl', clip right side of "lesser" input
443-
@include _get-rtl-selectors('.ranged input.start') {
443+
.ranged input.start:dir(rtl) {
444444
clip-path: inset(0 0 0 $_clip-to-end);
445445
}
446446

@@ -450,7 +450,7 @@ $_md-sys-shape: tokens.md-sys-shape-values();
450450
}
451451

452452
// in 'rtl', clip left side of "greater" input
453-
@include _get-rtl-selectors('.ranged input.end') {
453+
.ranged input.end:dir(rtl) {
454454
clip-path: inset(0 $_clip-to-start 0 0);
455455
}
456456

@@ -477,28 +477,6 @@ $_md-sys-shape: tokens.md-sys-shape-values();
477477
}
478478
}
479479

480-
// Creates a mixin of rtl selectors to construct distinct rulesets. If `:dir` is
481-
// supported, then it will take precedence over `:host-context` via a `@supports
482-
// not selector(:dir(rtl))` at-rule. Seprating rulesets ensure they are not
483-
// dropped on browsers where one is not supported;
484-
// Note, `:where` cannot be used to create compound selectors that contain
485-
// pseudo elements
486-
// (e.g. this does not work: `:where(:host([dir="rtl"]) .foo::after)`),
487-
@mixin _get-rtl-selectors($selector: '', $suffix: '') {
488-
$host-context-selectors: ':host-context([dir="rtl"]) #{$selector}#{$suffix}, :host([dir="rtl"]) #{$selector}#{$suffix}';
489-
$dir-selector: '#{$selector}:dir(rtl)#{$suffix}';
490-
491-
@supports not selector(:dir(rtl)) {
492-
#{$host-context-selectors} {
493-
@content;
494-
}
495-
}
496-
497-
#{$dir-selector} {
498-
@content;
499-
}
500-
}
501-
502480
// Returns a background-image with sized circular ticks of the given color.
503481
@function _get-tick-image($color) {
504482
@return radial-gradient(
@@ -537,10 +515,7 @@ $_md-sys-shape: tokens.md-sys-shape-values();
537515
transform: translateX(var(--_x-translate));
538516
}
539517

540-
@include _get-rtl-selectors(
541-
'input.#{$start-or-end}',
542-
'::-webkit-slider-thumb'
543-
) {
518+
input.#{$start-or-end}:dir(rtl)::-webkit-slider-thumb {
544519
transform: translateX(calc(-1 * var(--_x-translate)));
545520
}
546521
}

0 commit comments

Comments
 (0)