Skip to content

feat(ui5-option): provide stabledomref #2366

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

Merged
merged 3 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/main/src/Option.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ const metadata = {
value: {
type: String,
},

/**
* Defines the stable selector that you can use via getStableDomRef method.
* @public
* @since 1.0.0-rc.10
*/
stableDomRef: {
type: String,
},
},

events: /** @lends sap.ui.webcomponents.main.Option.prototype */ {},
Expand Down
10 changes: 10 additions & 0 deletions packages/main/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,15 @@ const metadata = {
* Once the drop-down is opened, you can use the <code>UP</code> and <code>DOWN</code> arrow keys
* to navigate through the available options and select one by pressing the <code>Space</code> or <code>Enter</code> keys.
* <br>
*
* <h3>Stable DOM Refs</h3>
*
* In the context of <code>ui5-select</code>, you can provide a custom stable DOM ref for:
* <ul>
* <li>Every <code>ui5-option</code> that you provide.
* Example: <code><ui5-option stable-dom-ref="option1"></ui5-option></code></li>
* </ul>
*
* <h3>ES6 Module Import</h3>
* <code>import "@ui5/webcomponents/dist/Select";</code>
* <br>
Expand Down Expand Up @@ -362,6 +371,7 @@ class Select extends UI5Element {
value: opt.value,
textContent: opt.textContent,
id: opt._id,
stableDomRef: opt.stableDomRef,
};
});

Expand Down
1 change: 1 addition & 0 deletions packages/main/src/SelectPopover.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
icon="{{this.icon}}"
?selected="{{this.selected}}"
?aria-selected="{{this.selected}}"
data-ui5-stable="{{this.stableDomRef}}"
>
{{this.textContent}}
</ui5-li>
Expand Down