question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SAP Enable Now: Support for data-help-id on targeted shadowDOM elements

See original GitHub issue

Is your feature request related to a problem? Please describe. SuccessFactors integrates with the SAP Enable Now (see https://www.sap.com/products/enable-now/features.html), sometimes called Web Assistant or User Assistant. For the global header we have a set of data-help-id values that need to be maintained from one release to the next, and the web assistant will use that data-help-id to find the element on the page, and somehow target the ClientRect for this element.

You could imagine the following code (not really from WebAssistant):

function highlightById(helpid) {
  const el = document.querySelector(`[data-help-id="${helpid}"]`);
  const rect = el && el.getClientRects();
  rect && highlightRegion(rect); // not implemented here
}

Now consider the following HTML:

<ui5-tabcontainer>
  <ui5-tab data-help-id="helpTab" text="Help"></ui5-tab>
  <ui5-tab data-help-id="formsTab" text="Forms"></ui5-tab>
</ui5-tabcontainer>

In this case - the data-help-ids are identified on <ui5-tab> elements; however, those elements have no ClientRect, because the actual <li> tag that the <ui5-tabcontainer> renders is the shadowRoot is the “real tab” and this one is just a placeholder which contains the text as an attribute.

Note that this would work fine with the following HTML:

<ui5-button data-help-id="myButton">Hello World</ui5-button>

The above button would work as expected from the Web Assistant perspective.

This same issue plagues a few different Web Components, and in general we need some sort of strategy for an external process to identify ClientRects on the page given a unique identifier. We may have some opportunity to change how the Web Assistant looks up the ClientRect; however, it would be great if the code did not need to change (since that would require to involve other teams and makes things more complicated).

For example - most of the things in the header would also need to be targeted, such as the search button, menu button, profile button, etc.

Describe the solution you’d like The same code would work for the <ui5-tab> as it does for <ui5-button> at least the ClientRect would be returned correctly (if that’s possible).

Describe alternatives you’ve considered Provide some other type of attribute on the <ui5-tab> which could be written to the shadowDOM’s <li> as the data-help-id attribute, and then the Web Assistant could be changed to somehow “walk” the DOM and every shadowRoot on the page looking for a light/shadow DOM element with data-help-id

Here is another idea:

<ui5-shellbar>
  <ui5-help-id slot="menuButton" data-helpid="bizxHeaderModulePicker"></ui5-help-id>
</ui5-shellbar>

In the above example, the data-helpid=“bizxHeaderModulePicker” is now present in the light DOM, but somehow the getClientRect is magically returning the rect of the menu button at the top left corner of the shellbar??

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fifoosidcommented, Jun 26, 2020

You have a point, looks like I have missed that. It is now implemented as well.

1reaction
codefactorcommented, Jun 24, 2020

@fifoosid ,

Looks good so far - I made a comment in the PR - I think you are missing the ShellBarItem which is similar to the Tab. The strategy seems good to me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Producer_Manual_en-US.pdf - SAP Enable Now
Welcome to Producer, the SAP Enable Now tool that enables you the creation of web-based learning content that.
Read more >
SAP Enable Now What's New
SAP Enable Now What's New. Introduction. PUBLIC. 1. WHAT'S NEW | PUBLIC. Version 1.0, Feature Pack 2005 | 28.05.2020. SAP Enable Now What's ......
Read more >
SAP Enable Now | SAP Community
Learn and share your knowledge about SAP Enable Now to help you easily create, maintain, and deliver performance support, learning material, ...
Read more >
What's New - SAP Enable Now
Desktop components of SAP Enable Now, Cloud edition are loaded and executed with the function Java Web Start, which is contained in Oracle...
Read more >
SAP Enable Now Manager, Cloud
It assists you to share the content you created in Producer or Instant Producer easily with other authors, align the.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found