Skip to content

Commit

Permalink
fix(ui5-input): inner input padding is correctly updated (#3015)
Browse files Browse the repository at this point in the history
Prevously, after padding: 0 was applied when the condition is false, it remained 0. That could be easily reproduced with native HTML as well. Setting 'undefined' as a value does not change the padding to the one specified in the component's css styles.
https://snippix.only.sap/snippets/52143
Now, when the padding should not be 0, the inline style is removed, instead of setting 'undefined' as a value

FIXES: #2940
  • Loading branch information
niyap committed Apr 1, 2021
1 parent 4b83c7b commit b00b02b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ class Input extends UI5Element {
}

get styles() {
return {
const stylesObject = {
popoverHeader: {
"max-width": `${this._inputWidth}px`,
},
Expand All @@ -1155,10 +1155,14 @@ class Input extends UI5Element {
suggestionsPopover: {
"max-width": `${this._inputWidth}px`,
},
innerInput: {
padding: this.nativeInputWidth < 48 ? "0" : undefined,
},
innerInput: {},
};

if (this.nativeInputWidth < 48) {
stylesObject.innerInput.padding = "0";
}

return stylesObject;
}

get suggestionSeparators() {
Expand Down

0 comments on commit b00b02b

Please sign in to comment.