-
Notifications
You must be signed in to change notification settings - Fork 664
Scheduler: width, maxWidth editing.popup not working #31835
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where custom width and maxWidth options specified in editing.popup were not being applied to the Scheduler's appointment popup. The fix stores these custom values and applies them dynamically in the updatePopupFullScreenMode() method, which is called when the popup is shown or when the window is resized.
Key Changes:
- Added storage for custom
widthandmaxWidthvalues fromediting.popupconfiguration - Modified
updatePopupFullScreenMode()to apply custom dimensions, with special handling for fullScreen mode
| this.popup.option('maxWidth', isFullScreen ? '100%' : maxWidth); | ||
|
|
||
| if (this.customWidth !== undefined) { | ||
| this.popup.option('width', this.customWidth); |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The width option should be conditional based on isFullScreen, similar to how maxWidth is handled below. When the popup is in fullScreen mode, the popup component internally sets width: '100%' (see _renderDimensions in the Popup component), so setting a custom width would be overridden and could cause confusion. Consider applying the same pattern:
if (this.customWidth !== undefined) {
this.popup.option('width', isFullScreen ? '100%' : this.customWidth);
}| this.popup.option('width', this.customWidth); | |
| this.popup.option('width', isFullScreen ? '100%' : this.customWidth); |
| this.customWidth = customPopupOptions.width; | ||
| this.customMaxWidth = customPopupOptions.maxWidth; |
Copilot
AI
Nov 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new width and maxWidth customization functionality lacks test coverage. Consider adding tests similar to the existing test at line 1454 ('should pass custom popup options from editing.popup to appointment popup') to verify:
- Custom
widthis applied when specified inediting.popup.width - Custom
maxWidthis applied when specified inediting.popup.maxWidth - The behavior is correct when
updatePopupFullScreenMode()is called - Both properties work correctly in fullScreen and non-fullScreen modes
packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/scheduler/appointment_popup/m_popup.ts
Show resolved
Hide resolved
# Conflicts: # packages/devextreme/js/__internal/scheduler/appointment_popup/appointment_popup.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
packages/devextreme/js/__internal/scheduler/appointment_popup/appointment_popup.test.ts
Show resolved
Hide resolved
| afterEach(() => { | ||
| Object.defineProperty(document.documentElement, 'clientWidth', { | ||
| writable: true, | ||
| configurable: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In after, we set this value to the same as in before. Remove, or set it diff state
writable props don't have affect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| // Mock window width to avoid fullscreen mode | ||
| beforeEach(() => { | ||
| Object.defineProperty(document.documentElement, 'clientWidth', { | ||
| value: 1280, | ||
| }); | ||
| }); | ||
|
|
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Object.defineProperty call should include configurable: true to allow cleanup and make the property properly overridable. Additionally, consider adding an afterEach hook to restore the original clientWidth value to prevent side effects on other tests.
beforeEach(() => {
Object.defineProperty(document.documentElement, 'clientWidth', {
value: 1280,
configurable: true, // Add this
});
});| // Mock window width to avoid fullscreen mode | |
| beforeEach(() => { | |
| Object.defineProperty(document.documentElement, 'clientWidth', { | |
| value: 1280, | |
| }); | |
| }); | |
| // Mock window width to avoid fullscreen mode | |
| let originalClientWidthDescriptor: PropertyDescriptor | undefined; | |
| beforeEach(() => { | |
| // Save the original descriptor so we can restore it after each test | |
| originalClientWidthDescriptor = Object.getOwnPropertyDescriptor(document.documentElement, 'clientWidth'); | |
| Object.defineProperty(document.documentElement, 'clientWidth', { | |
| value: 1280, | |
| configurable: true, | |
| }); | |
| }); | |
| afterEach(() => { | |
| if (originalClientWidthDescriptor) { | |
| Object.defineProperty(document.documentElement, 'clientWidth', originalClientWidthDescriptor); | |
| } else { | |
| // If there was no original descriptor, remove the property | |
| delete (document.documentElement as any).clientWidth; | |
| } | |
| }); |
No description provided.