Skip to content

Commit 368a430

Browse files
Popup: scrollbar appears when content does not overflow the height (T1253645) (#28779) (#28785)
1 parent 0274499 commit 368a430

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

packages/devextreme-scss/scss/widgets/base/_popup.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
}
4343

4444
& .dx-popup-content > .dx-template-wrapper {
45+
display: flow-root;
4546
height: 100%;
4647
width: 100%;
4748
}

packages/devextreme/js/__internal/ui/popup/m_popup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const POPUP_FULL_SCREEN_CLASS = 'dx-popup-fullscreen';
4646
const POPUP_FULL_SCREEN_WIDTH_CLASS = 'dx-popup-fullscreen-width';
4747
const POPUP_NORMAL_CLASS = 'dx-popup-normal';
4848
const POPUP_CONTENT_CLASS = 'dx-popup-content';
49-
const POPUP_CONTENT_SCROLLABLE_CLASS = 'dx-popup-content-scrollable';
49+
export const POPUP_CONTENT_SCROLLABLE_CLASS = 'dx-popup-content-scrollable';
5050

5151
const DISABLED_STATE_CLASS = 'dx-state-disabled';
5252
const POPUP_DRAGGABLE_CLASS = 'dx-popup-draggable';
@@ -58,7 +58,7 @@ const POPUP_BOTTOM_CLASS = 'dx-popup-bottom';
5858

5959
const POPUP_HAS_CLOSE_BUTTON_CLASS = 'dx-has-close-button';
6060

61-
const TEMPLATE_WRAPPER_CLASS = 'dx-template-wrapper';
61+
export const TEMPLATE_WRAPPER_CLASS = 'dx-template-wrapper';
6262

6363
const POPUP_CONTENT_FLEX_HEIGHT_CLASS = 'dx-popup-flex-height';
6464
const POPUP_CONTENT_INHERIT_HEIGHT_CLASS = 'dx-popup-inherit-height';

packages/devextreme/testing/tests/DevExpress.ui.widgets/popup.tests.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import themes from 'ui/themes';
2525
import executeAsyncMock from '../../helpers/executeAsyncMock.js';
2626
import visibilityChangeUtils from 'events/visibility_change';
2727
import domAdapter from 'core/dom_adapter';
28+
import {
29+
TEMPLATE_WRAPPER_CLASS,
30+
POPUP_CONTENT_SCROLLABLE_CLASS,
31+
} from '__internal/ui/popup/m_popup';
2832

2933
import 'generic_light.css!';
3034
import 'ui/popup';
@@ -37,7 +41,6 @@ const IS_IOS_DEVICE = devices.real().platform === 'ios';
3741
const IS_OLD_SAFARI = IS_SAFARI && compareVersions(browser.version, [11]) < 0;
3842
const PREVENT_SAFARI_SCROLLING_CLASS = 'dx-prevent-safari-scrolling';
3943

40-
const POPUP_CONTENT_SCROLLABLE_CLASS = 'dx-popup-content-scrollable';
4144
const TOOLBAR_LABEL_CLASS = 'dx-toolbar-label';
4245

4346
themes.setDefaultTimeout(0);
@@ -694,7 +697,7 @@ QUnit.module('dimensions', {
694697
'title': {
695698
render: function(args) {
696699
const $element = $('<span>')
697-
.addClass('dx-template-wrapper')
700+
.addClass(TEMPLATE_WRAPPER_CLASS)
698701
.text('text');
699702

700703
return $element.get(0);
@@ -1094,6 +1097,25 @@ QUnit.module('options changed callbacks', {
10941097
assert.strictEqual(minHeight, '0px', 'minHeight is inherited correctly');
10951098
});
10961099

1100+
QUnit.test('Template wrapper element uses "display: flow-root" to prevent the appearance of scrollbar (T1253645)', function(assert) {
1101+
const popup = $('#popup').dxPopup({
1102+
visible: true,
1103+
width: 300,
1104+
height: 300,
1105+
showTitle: false,
1106+
contentTemplate() {
1107+
return $('<div>')
1108+
.addClass(TEMPLATE_WRAPPER_CLASS)
1109+
.append('<p>test content</p>');
1110+
}
1111+
}).dxPopup('instance');
1112+
1113+
const $templateWrapper = popup.$content().find(`.${TEMPLATE_WRAPPER_CLASS}`);
1114+
const overflow = $templateWrapper.css('display');
1115+
1116+
assert.strictEqual(overflow, 'flow-root', 'overflow property is set to hidden');
1117+
});
1118+
10971119
QUnit.test('popup height should support TreeView with Search if height = auto (T724029)', function(assert) {
10981120
if(IS_OLD_SAFARI) {
10991121
assert.expect(0);

0 commit comments

Comments
 (0)