|
79 | 79 | * unhiding the calendar content.
|
80 | 80 | * To workaround this, we set the opacity
|
81 | 81 | * of the content to 0 and hide it offscreen.
|
82 |
| - * TODO: This is fixed in Safari 15+, so remove |
83 |
| - * when Safari 14 support is dropped. |
| 82 | + * |
| 83 | + * -webkit-named-image is something only WebKit supports |
| 84 | + * so we use this to detect general WebKit support. |
| 85 | + * aspect-ratio is only supported in Safari 15+ |
| 86 | + * so by checking lack of aspect-ratio support, we know |
| 87 | + * that we are in a pre-Safari 15 browser. |
| 88 | + * |
| 89 | + * TODO(FW-554): Remove when iOS 14 support is dropped. |
84 | 90 | */
|
85 |
| -:host(.show-month-and-year) .calendar-next-prev, |
86 |
| -:host(.show-month-and-year) .calendar-days-of-week, |
87 |
| -:host(.show-month-and-year) .calendar-body, |
88 |
| -:host(.show-month-and-year) .datetime-time { |
89 |
| - @include position(null, null, null, -99999px); |
| 91 | +@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)) { |
| 92 | + :host(.show-month-and-year) .calendar-next-prev, |
| 93 | + :host(.show-month-and-year) .calendar-days-of-week, |
| 94 | + :host(.show-month-and-year) .calendar-body, |
| 95 | + :host(.show-month-and-year) .datetime-time { |
| 96 | + @include position(null, null, null, -99999px); |
90 | 97 |
|
91 |
| - position: absolute; |
| 98 | + position: absolute; |
92 | 99 |
|
93 |
| - /** |
94 |
| - * Use visibility instead of |
95 |
| - * opacity to ensure element |
96 |
| - * cannot receive focus |
97 |
| - */ |
98 |
| - visibility: hidden; |
99 |
| - pointer-events: none; |
| 100 | + /** |
| 101 | + * Use visibility instead of |
| 102 | + * opacity to ensure element |
| 103 | + * cannot receive focus |
| 104 | + */ |
| 105 | + visibility: hidden; |
| 106 | + pointer-events: none; |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +/** |
| 111 | + * This support check two cases: |
| 112 | + * 1. A WebKit browser that supports aspect-ratio (Safari 15+) |
| 113 | + * 2. Any non-WebKit browser. |
| 114 | + * Note that just overriding this display: none is not |
| 115 | + * sufficient to resolve the issue mentioned above, which |
| 116 | + * is why we do another set of @supports checks. |
| 117 | + */ |
| 118 | +@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)) { |
| 119 | + :host(.show-month-and-year) .calendar-next-prev, |
| 120 | + :host(.show-month-and-year) .calendar-days-of-week, |
| 121 | + :host(.show-month-and-year) .calendar-body, |
| 122 | + :host(.show-month-and-year) .datetime-time { |
| 123 | + display: none; |
| 124 | + } |
100 | 125 | }
|
101 | 126 |
|
102 | 127 | :host(.datetime-readonly),
|
|
0 commit comments