Skip to content

Commit 50304f5

Browse files
authored
feat(ui5-option): provide stableDomRef (#2366)
Fixes: #1718
1 parent 38c9b53 commit 50304f5

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

packages/main/src/Option.js

+9
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ const metadata = {
4343
value: {
4444
type: String,
4545
},
46+
47+
/**
48+
* Defines the stable selector that you can use via getStableDomRef method.
49+
* @public
50+
* @since 1.0.0-rc.10
51+
*/
52+
stableDomRef: {
53+
type: String,
54+
},
4655
},
4756
slots: {
4857
"default": {

packages/main/src/Select.js

+10
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,15 @@ const metadata = {
243243
* Once the drop-down is opened, you can use the <code>UP</code> and <code>DOWN</code> arrow keys
244244
* to navigate through the available options and select one by pressing the <code>Space</code> or <code>Enter</code> keys.
245245
* <br>
246+
*
247+
* <h3>Stable DOM Refs</h3>
248+
*
249+
* In the context of <code>ui5-select</code>, you can provide a custom stable DOM ref for:
250+
* <ul>
251+
* <li>Every <code>ui5-option</code> that you provide.
252+
* Example: <code><ui5-option stable-dom-ref="option1"></ui5-option></code></li>
253+
* </ul>
254+
*
246255
* <h3>ES6 Module Import</h3>
247256
* <code>import "@ui5/webcomponents/dist/Select";</code>
248257
* <br>
@@ -361,6 +370,7 @@ class Select extends UI5Element {
361370
value: opt.value,
362371
textContent: opt.textContent,
363372
id: opt._id,
373+
stableDomRef: opt.stableDomRef,
364374
};
365375
});
366376

packages/main/src/SelectPopover.hbs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
icon="{{this.icon}}"
5252
?selected="{{this.selected}}"
5353
?aria-selected="{{this.selected}}"
54+
data-ui5-stable="{{this.stableDomRef}}"
5455
>
5556
{{this.textContent}}
5657
</ui5-li>

0 commit comments

Comments
 (0)