-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add
enableDefaultTooltips
config option (#9559)
This configuration option defines whether components will display default tooltips in specific cases. Default tooltips are generally recommended to cover accessibility standards and typically you would not need to modify this setting. However, in rare cases you may want to implement custom tooltip visualisation and turn off the default tooltips. To do so, set enableDefaultTooltips to false. Fixes: #9494
- Loading branch information
Showing
11 changed files
with
151 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { getEnableDefaultTooltips as getConfiguredEnableDefaultTooltips } from "../InitialConfiguration.js"; | ||
|
||
let _enableDefaultTooltips: boolean; | ||
|
||
/** | ||
* Returns if the "enableDefaultTooltips" configuration is set. | ||
* @public | ||
* @since 2.1.0 | ||
* @returns { boolean } | ||
*/ | ||
const getEnableDefaultTooltips = (): boolean => { | ||
if (_enableDefaultTooltips === undefined) { | ||
_enableDefaultTooltips = getConfiguredEnableDefaultTooltips(); | ||
} | ||
|
||
return _enableDefaultTooltips; | ||
}; | ||
|
||
/** | ||
* Defines the "enableDefaultTooltips" setting. | ||
* | ||
* - When set to "true" (default), the components will display default tooltips. | ||
* - When set to "false", the components will NOT display default tooltips. | ||
* | ||
* @public | ||
* @since 2.1.0 | ||
* @param { boolean } enableDefaultTooltips | ||
*/ | ||
const setEnableDefaultTooltips = (enableDefaultTooltips: boolean) => { | ||
_enableDefaultTooltips = enableDefaultTooltips; | ||
}; | ||
|
||
export { | ||
getEnableDefaultTooltips, | ||
setEnableDefaultTooltips, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | ||
<title>Tooltips</title> | ||
<script src="../%VITE_BUNDLE_PATH%" type="module"></script> | ||
</head> | ||
|
||
<body class="card1auto"> | ||
<ui5-icon name="settings"></ui5-icon> | ||
<ui5-icon name="settings" show-tooltip></ui5-icon> | ||
<ui5-button id="btn" icon="settings"></ui5-button> | ||
<ui5-rating-indicator id="rt" icon="settings"></ui5-rating-indicator> | ||
<ui5-toggle-button icon="settings"></ui5-toggle-button> | ||
<ui5-segmented-button id="segBtn"> | ||
<ui5-segmented-button-item id="segBtnItem" icon="add"></ui5-segmented-button-item> | ||
<ui5-segmented-button-item id="segBtnItem2" icon="settings"></ui5-segmented-button-item> | ||
<ui5-segmented-button-item id="segBtnItem3" icon="activate"></ui5-segmented-button-item> | ||
</ui5-segmented-button> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { assert } from "chai"; | ||
|
||
describe("Default Tooltips", () => { | ||
before(async () => { | ||
await browser.url(`test/pages/base/Tooltips.html?sap-ui-enableDefaultTooltips=false`); | ||
}); | ||
|
||
it("Tooltips turned off", async () => { | ||
const btn = await browser.$("#btn").shadow$(".ui5-button-root"); | ||
const btnIcon = await browser.$("#btn").shadow$(".ui5-button-icon"); | ||
const rt = await browser.$("#rt").shadow$(".ui5-rating-indicator-root"); | ||
const segBtnItem = await browser.$("#segBtnItem").shadow$(".ui5-segmented-button-item-root"); | ||
const segBtnItemIcon = await browser.$("#segBtnItem").shadow$(".ui5-segmented-button-item-icon"); | ||
|
||
const btnTitle = await btn.getAttribute("title"); | ||
const btnIconTitle = await btnIcon.getAttribute("title"); | ||
const rtTitle = await rt.getAttribute("title"); | ||
const segBtnItemTitle = await segBtnItem.getAttribute("title"); | ||
const segBtnItemIconTitle = await segBtnItemIcon.getAttribute("title"); | ||
|
||
assert.notOk(btnTitle, "An icon only Button has no default tooltip."); | ||
assert.notOk(btnIconTitle, "An icon only Button icon has no default tooltip."); | ||
assert.notOk(rtTitle, "The Rating Indicator has no default tooltip."); | ||
assert.notOk(segBtnItemTitle, "An icon only Segmented Button Item has no default tooltip"); | ||
assert.notOk(segBtnItemIconTitle, "An icon only Segmented Button Item icon has no default tooltip"); | ||
}); | ||
}); |