Skip to content

Commit

Permalink
refactor(ui5-input): remove highlight property (#3350)
Browse files Browse the repository at this point in the history
All inputs by SAP Fiori 3 Specification should highlight matching suggestions.

BREAKING CHANGE: The highlight property is removed and the feature is enabled by default
MapTo0 authored May 28, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent dac8183 commit 6630c2a
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ const metadata = {
*
* @type {boolean}
* @defaultvalue false
* @public
* @private
* @sicne 1.0.0-rc.8
*/
highlight: {
@@ -814,13 +814,13 @@ class Input extends UI5Element {

enableSuggestions() {
if (this.Suggestions) {
this.Suggestions.highlight = this.highlight;
return;
}

const Suggestions = getFeature("InputSuggestions");

if (Suggestions) {
this.Suggestions = new Suggestions(this, "suggestionItems", this.highlight);
this.Suggestions = new Suggestions(this, "suggestionItems", true);
} else {
throw new Error(`You have to import "@ui5/webcomponents/dist/features/InputSuggestions.js" module to use ui5-input suggestions`);
}
6 changes: 3 additions & 3 deletions packages/main/test/pages/Input.html
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ <h3>Input in Cozy</h3>
style="width: 500px"
show-suggestions
placeholder="Search for a country ..."
highlight>
>
</ui5-input>
</div>

@@ -63,7 +63,7 @@ <h3>Input suggestions with grouping</h3>
</ui5-input>

<h3>Input suggestions with highlighing</h3>
<ui5-input id="myInputHighlighted" highlight show-suggestions style="width: 100%">
<ui5-input id="myInputHighlighted" show-suggestions style="width: 100%">
<ui5-suggestion-item text="Adam D" description="Administrative Support"></ui5-suggestion-item>
<ui5-suggestion-item text="Aanya Sing" description="Administrative Support"></ui5-suggestion-item>
<ui5-suggestion-item text="Allen K" description="Technical Support"></ui5-suggestion-item>
@@ -288,7 +288,7 @@ <h3>Test ariaLabel and ariaLabelledBy</h3>
<ui5-input aria-labelledby="enterNameLabel"></ui5-input>

<h3>Input suggestions with highlighing and XSS test</h3>
<ui5-input highlight show-suggestions style="width: 100%">
<ui5-input show-suggestions style="width: 100%">
<ui5-suggestion-item text="<script>alert('XSS')</script>" description="Administrative Support"></ui5-suggestion-item>
<ui5-suggestion-item text="Aanya Sing" description="<b onmouseover=alert('XSS')></b>">
</ui5-suggestion-item>

0 comments on commit 6630c2a

Please sign in to comment.