Skip to content

Commit 27422d6

Browse files
authored
fix: update media query to work with larger phones (#8116)
1 parent 615365c commit 27422d6

File tree

6 files changed

+14
-22
lines changed

6 files changed

+14
-22
lines changed

packages/context-menu/src/vaadin-context-menu-mixin.js

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
66
import { isElementFocusable } from '@vaadin/a11y-base/src/focus-utils.js';
7-
import { isAndroid, isIOS, isTouch } from '@vaadin/component-base/src/browser-utils.js';
7+
import { isAndroid, isIOS } from '@vaadin/component-base/src/browser-utils.js';
88
import { addListener, deepTargetFind, gestures, removeListener } from '@vaadin/component-base/src/gestures.js';
99
import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
1010
import { ItemsMixin } from './vaadin-contextmenu-items-mixin.js';
@@ -110,21 +110,13 @@ export const ContextMenuMixin = (superClass) =>
110110
type: Boolean,
111111
},
112112

113-
/** @private */
114-
_touch: {
115-
type: Boolean,
116-
value: isTouch,
117-
},
118-
119-
/** @private */
120-
_wide: {
113+
_fullscreen: {
121114
type: Boolean,
122115
},
123116

124-
/** @private */
125-
_wideMediaQuery: {
117+
_fullscreenMediaQuery: {
126118
type: String,
127-
value: '(min-device-width: 750px)',
119+
value: '(max-width: 450px), (max-height: 450px)',
128120
},
129121
};
130122
}
@@ -134,7 +126,7 @@ export const ContextMenuMixin = (superClass) =>
134126
'_openedChanged(opened)',
135127
'_targetOrOpenOnChanged(listenOn, openOn)',
136128
'_rendererChanged(renderer, items)',
137-
'_touchOrWideChanged(_touch, _wide)',
129+
'_fullscreenChanged(_fullscreen)',
138130
'_overlayContextChanged(_overlayElement, _context)',
139131
'_overlayModelessChanged(_overlayElement, _modeless)',
140132
'_overlayPhoneChanged(_overlayElement, _phone)',
@@ -182,8 +174,8 @@ export const ContextMenuMixin = (superClass) =>
182174
super.ready();
183175

184176
this.addController(
185-
new MediaQueryController(this._wideMediaQuery, (matches) => {
186-
this._wide = matches;
177+
new MediaQueryController(this._fullscreenMediaQuery, (matches) => {
178+
this._fullscreen = matches;
187179
}),
188180
);
189181
}
@@ -282,8 +274,8 @@ export const ContextMenuMixin = (superClass) =>
282274
}
283275

284276
/** @private */
285-
_touchOrWideChanged(touch, wide) {
286-
this._phone = !wide && touch;
277+
_fullscreenChanged(fullScreen) {
278+
this._phone = fullScreen;
287279
}
288280

289281
/** @private */

packages/date-picker/src/vaadin-date-picker-mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export const DatePickerMixin = (subclass) =>
184184
* @protected
185185
*/
186186
_fullscreenMediaQuery: {
187-
value: '(max-width: 420px), (max-height: 420px)',
187+
value: '(max-width: 450px), (max-height: 450px)',
188188
},
189189

190190
/**

packages/date-picker/theme/lumo/vaadin-date-picker-overlay-styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const datePickerOverlay = css`
4141
margin-bottom: var(--lumo-space-xs);
4242
}
4343
44-
@media (max-width: 420px), (max-height: 420px) {
44+
@media (max-width: 450px), (max-height: 450px) {
4545
[part='overlay'] {
4646
width: 100vw;
4747
height: 70vh;

packages/date-picker/theme/lumo/vaadin-date-picker-styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const datePicker = css`
1212
content: var(--lumo-icons-cross);
1313
}
1414
15-
@media (max-width: 420px), (max-height: 420px) {
15+
@media (max-width: 450px), (max-height: 450px) {
1616
[part='overlay-content'] {
1717
height: 70vh;
1818
}

packages/select/src/vaadin-select-base-mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export const SelectBaseMixin = (superClass) =>
143143

144144
/** @private */
145145
_phoneMediaQuery: {
146-
value: '(max-width: 420px), (max-height: 420px)',
146+
value: '(max-width: 450px), (max-height: 450px)',
147147
},
148148

149149
/** @private */

packages/vaadin-lumo-styles/mixins/menu-overlay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ registerStyles('', menuOverlayCore, { moduleId: 'lumo-menu-overlay-core' });
4545
const menuOverlayExt = css`
4646
/* Small viewport (bottom sheet) styles */
4747
/* Use direct media queries instead of the state attributes ([phone] and [fullscreen]) provided by the elements */
48-
@media (max-width: 420px), (max-height: 420px) {
48+
@media (max-width: 450px), (max-height: 450px) {
4949
:host {
5050
top: 0 !important;
5151
right: 0 !important;

0 commit comments

Comments
 (0)