Skip to content

Commit

Permalink
fix: update media query to work with larger phones (#8116)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoCardoso authored and vaadin-bot committed Dec 9, 2024
1 parent a5b0ba9 commit 018904f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
26 changes: 9 additions & 17 deletions packages/context-menu/src/vaadin-context-menu-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import { isElementFocusable } from '@vaadin/a11y-base/src/focus-utils.js';
import { isAndroid, isIOS, isTouch } from '@vaadin/component-base/src/browser-utils.js';
import { isAndroid, isIOS } from '@vaadin/component-base/src/browser-utils.js';
import { addListener, deepTargetFind, gestures, removeListener } from '@vaadin/component-base/src/gestures.js';
import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
import { ItemsMixin } from './vaadin-contextmenu-items-mixin.js';
Expand Down Expand Up @@ -110,21 +110,13 @@ export const ContextMenuMixin = (superClass) =>
type: Boolean,
},

/** @private */
_touch: {
type: Boolean,
value: isTouch,
},

/** @private */
_wide: {
_fullscreen: {
type: Boolean,
},

/** @private */
_wideMediaQuery: {
_fullscreenMediaQuery: {
type: String,
value: '(min-device-width: 750px)',
value: '(max-width: 450px), (max-height: 450px)',
},
};
}
Expand All @@ -134,7 +126,7 @@ export const ContextMenuMixin = (superClass) =>
'_openedChanged(opened)',
'_targetOrOpenOnChanged(listenOn, openOn)',
'_rendererChanged(renderer, items)',
'_touchOrWideChanged(_touch, _wide)',
'_fullscreenChanged(_fullscreen)',
'_overlayContextChanged(_overlayElement, _context)',
'_overlayModelessChanged(_overlayElement, _modeless)',
'_overlayPhoneChanged(_overlayElement, _phone)',
Expand Down Expand Up @@ -182,8 +174,8 @@ export const ContextMenuMixin = (superClass) =>
super.ready();

this.addController(
new MediaQueryController(this._wideMediaQuery, (matches) => {
this._wide = matches;
new MediaQueryController(this._fullscreenMediaQuery, (matches) => {
this._fullscreen = matches;
}),
);
}
Expand Down Expand Up @@ -282,8 +274,8 @@ export const ContextMenuMixin = (superClass) =>
}

/** @private */
_touchOrWideChanged(touch, wide) {
this._phone = !wide && touch;
_fullscreenChanged(fullScreen) {
this._phone = fullScreen;
}

/** @private */
Expand Down
2 changes: 1 addition & 1 deletion packages/date-picker/src/vaadin-date-picker-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const DatePickerMixin = (subclass) =>
* @protected
*/
_fullscreenMediaQuery: {
value: '(max-width: 420px), (max-height: 420px)',
value: '(max-width: 450px), (max-height: 450px)',
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const datePickerOverlay = css`
margin-bottom: var(--lumo-space-xs);
}
@media (max-width: 420px), (max-height: 420px) {
@media (max-width: 450px), (max-height: 450px) {
[part='overlay'] {
width: 100vw;
height: 70vh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const datePicker = css`
content: var(--lumo-icons-cross);
}
@media (max-width: 420px), (max-height: 420px) {
@media (max-width: 450px), (max-height: 450px) {
[part='overlay-content'] {
height: 70vh;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/select/src/vaadin-select-base-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const SelectBaseMixin = (superClass) =>

/** @private */
_phoneMediaQuery: {
value: '(max-width: 420px), (max-height: 420px)',
value: '(max-width: 450px), (max-height: 450px)',
},

/** @private */
Expand Down
2 changes: 1 addition & 1 deletion packages/vaadin-lumo-styles/mixins/menu-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ registerStyles('', menuOverlayCore, { moduleId: 'lumo-menu-overlay-core' });
const menuOverlayExt = css`
/* Small viewport (bottom sheet) styles */
/* Use direct media queries instead of the state attributes ([phone] and [fullscreen]) provided by the elements */
@media (max-width: 420px), (max-height: 420px) {
@media (max-width: 450px), (max-height: 450px) {
:host {
top: 0 !important;
right: 0 !important;
Expand Down

0 comments on commit 018904f

Please sign in to comment.