Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update media query to work with larger phones (#8116) (CP: 24.5) #8303

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -125,7 +125,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
Loading