File tree Expand file tree Collapse file tree 3 files changed +21
-19
lines changed Expand file tree Collapse file tree 3 files changed +21
-19
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
@use " sass:list" ;
2
2
3
- /// Add active, focus and hover pseudo selectors to element
4
- ///
5
- /// @param {string||list} $additionalSelectors
6
- /// List of additional selectors
7
- @mixin hover ($additionalSelectors : null) {
3
+ /* *
4
+ * Add active, focus and hover pseudo selectors to element
5
+ * @param {string||list} $additionalSelectors
6
+ * List of additional selectors
7
+ *
8
+ * @param {boolean} $onlyNoTouch
9
+ * The hover style will only work when the user is using a tool device like a mouse or a trackpad.
10
+ * https://defensivecss.dev/tip/hover-media/
11
+ * https://developer.mozilla.org/fr/docs/Web/CSS/@media/hover
12
+ */
13
+ @mixin hover ($onlyNoTouch : null, $additionalSelectors : null) {
8
14
$selectors : " &:hover" , " &:active" , " &:focus" ;
9
15
10
16
@if ($additionalSelectors ) {
16
22
}
17
23
}
18
24
19
- #{$selectors } {
20
- @content ;
25
+ @if $onlyNoTouch {
26
+ @media (hover : hover) {
27
+ #{$selectors } {
28
+ @content ;
29
+ }
30
+ }
31
+ } @else {
32
+ #{$selectors } {
33
+ @content ;
34
+ }
21
35
}
22
36
}
Original file line number Diff line number Diff line change 24
24
@import " ./m-editor-only" ;
25
25
@import " ./m-heading" ;
26
26
@import " ./m-hover" ;
27
- @import " ./m-hover-prevent-touch" ;
28
27
@import " ./m-line-clamp" ;
29
28
@import " ./m-placeholder-media" ;
30
29
@import " ./m-radio-custom" ;
You can’t perform that action at this time.
0 commit comments