Skip to content

Commit

Permalink
feat(ui5-li): title attribute handle (#3385)
Browse files Browse the repository at this point in the history
  • Loading branch information
fifoosid authored and ilhan007 committed Jun 30, 2021
1 parent 2bf99af commit ec4273d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/main/src/ListItem.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
aria-selected="{{ariaSelected}}"
role="{{_accInfo.role}}"
aria-expanded="{{_accInfo.ariaExpanded}}"
title="{{title}}"
aria-level="{{_accInfo.ariaLevel}}"
aria-posinset="{{_accInfo.posinset}}"
aria-setsize="{{_accInfo.setsize}}"
Expand Down
11 changes: 11 additions & 0 deletions packages/main/src/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ const metadata = {
type: Boolean,
},

/**
* Defines the tooltip of the component.
* @type {string}
* @defaultvalue ""
* @private
* @since 1.0.0-rc.15
*/
title: {
type: String,
},

/**
* Indicates if the list item is actionable, e.g has hover and pressed effects.
*
Expand Down
6 changes: 3 additions & 3 deletions packages/main/src/SuggestionListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const metadata = {
type: HTMLElement,
},
"default": {
propertyName: "title",
propertyName: "titleText",
},
},
};
Expand All @@ -48,11 +48,11 @@ class SuggestionListItem extends StandardListItem {

onBeforeRendering(...params) {
super.onBeforeRendering(...params);
this.hasTitle = !!this.title.length;
this.hasTitle = !!this.titleText.length;
}

get effectiveTitle() {
return this.title.map(el => el.textContent).join("");
return this.titleText.filter(node => node.nodeType !== Node.COMMENT_NODE).map(el => el.textContent).join("");
}

get hasDescription() {
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/Tree.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
icon="{{this.treeItem.icon}}"
info="{{this.treeItem.info}}"
info-state="{{this.treeItem.infoState}}"
title="{{this.treeItem.title}}"
?_toggle-button-end="{{ ../_toggleButtonEnd}}"
?_minimal="{{../_minimal}}"
.treeItem="{{this.treeItem}}"
Expand Down
11 changes: 11 additions & 0 deletions packages/main/src/TreeItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ const metadata = {
type: ValueState,
defaultValue: ValueState.None,
},

/**
* Defines the tooltip of the component.
* @type {string}
* @defaultvalue ""
* @private
* @since 1.0.0-rc.15
*/
title: {
type: String,
},
},
managedSlots: true,
slots: /** @lends sap.ui.webcomponents.main.TreeItem.prototype */ {
Expand Down

0 comments on commit ec4273d

Please sign in to comment.