Skip to content

Commit 7bdd21a

Browse files
committed
MC-2343: Safari & Firefox Issues With Grid Size Form
- Resolve issue with selection of input in Safari - Add validation for non numeric values
1 parent ddf45e8 commit 7bdd21a

File tree

5 files changed

+19
-3
lines changed

5 files changed

+19
-3
lines changed

app/code/Magento/PageBuilder/Test/Mftf/Data/ColumnData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
<data key="invalidDefaultGridSizeErrorMessage">Default grid size must be less than the maximum grid size.</data>
187187
<data key="invalidDigitErrorMessage">Please enter a valid number in this field.</data>
188188
<data key="greaterThanOneErrorMessage">Please enter a number 2 or greater in this field.</data>
189+
<data key="invalidNumberErrorMessage">Please enter a valid number.</data>
189190
<data key="minimumGridSizeErrorMessage">The minimum grid size supported is 2.</data>
190191
<data key="maximumGridSizeErrorMessage">The maximum grid size supported is</data>
191192
<data key="smallerThanTotalColumnsErrorMessage">Grid size cannot be smaller than the current total amount of columns, minus any empty columns.</data>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderColumnGridTest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,14 @@
623623
<argument name="index" value="1"/>
624624
<argument name="errorMessage" value="PageBuilderGridSize.minimumGridSizeErrorMessage"/>
625625
</actionGroup>
626+
<!-- Check validation occurs when entering as text -->
627+
<comment userInput="Check validation occurs when entering as text" stepKey="commentValidateStringInput"/>
628+
<executeJS function="document.evaluate(&quot;{{PageBuilderColumnSection.gridSizeInput('1')}}&quot;, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.setAttribute('type', 'text')" stepKey="changeInputToText" />
629+
<actionGroup ref="updateGridSizeInvalid" stepKey="enterInvalidGridSizeString">
630+
<argument name="gridSize" value="InvalidString"/>
631+
<argument name="index" value="1"/>
632+
<argument name="errorMessage" value="PageBuilderGridSize.invalidNumberErrorMessage"/>
633+
</actionGroup>
626634
</test>
627635
<test name="ValidateDifferentGridSizePerGroup">
628636
<annotations>

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/content-type/column-group/_default.less

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@
126126
visibility: visible;
127127
}
128128

129-
.no-user-select;
130-
131129
.pagebuilder-options {
132130
display: none;
133131
}

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/column-group/preview.js

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/column-group/preview.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import $ from "jquery";
77
import ko from "knockout";
8+
import $t from "mage/translate";
89
import events from "uiEvents";
910
import _ from "underscore";
1011
import Config from "../../config";
@@ -382,6 +383,10 @@ export default class Preview extends PreviewCollection {
382383
* Update the grid size on enter or blur of the input
383384
*/
384385
public updateGridSize() {
386+
if (!$.isNumeric(this.gridSizeInput())) {
387+
this.gridSizeError($t("Please enter a valid number."));
388+
}
389+
385390
const newGridSize = parseInt(this.gridSizeInput().toString(), 10);
386391
if (newGridSize || newGridSize === 0) {
387392
if (newGridSize !== this.resizeUtils.getGridSize()) {

0 commit comments

Comments
 (0)