SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.47k stars 254 forks source link

Cannot add data automation id property to MenuItem #9065

Closed Ilian-Allaf closed 1 week ago

Ilian-Allaf commented 1 month ago

Bug Description

When adding automationId to MenuItem, the property don't appear on the DOM element.

Affected Component

MenuItem

Expected Behaviour

No response

Isolated Example

No response

Steps to Reproduce

  1. Add automationId property to a MenuItem component
  2. Find your MenuItem on the DOM and look at its properties

Log Output, Stack Trace or Screenshots

No response

Priority

None

UI5 Web Components Version

1.24.0

Browser

Chrome

Operating System

No response

Additional Context

No response

Organization

SAP

Declaration

plamenivanov91 commented 1 month ago

Hello @Ilian-Allaf ,

The automationId doesn't exist as property of the MenuItem.

Could you please provide a snippet with your use case in order to determine if it's supported or not?

Regards, Plamen Ivanov

amaillard-sap commented 1 month ago

The data-automation-id attribute is a mandatory attribute in order to assign hotspots in web assistant + is used for automation purpose including the parsing of translation in the Rigi tool. Being unable to inject this attribute on some elements put us out of SAP development standard & best practices.

This is considered High priority on SBPA product.

plamenivanov91 commented 1 month ago

Hello @amaillard-sap ,

As automationId is not something we officially support, can you use the native

You can use the native API setAttribute('automationId', 'test id') as shown in this snippet.

Can you confirm if this is sufficient solution for you ?

Regards, Plamen Ivanov

amaillard-sap commented 1 month ago

We do not need to use the native API, we can directly set the data-automation-id on the web component, the problem is that this property on the ui5-menu-item is not transfered to the created ui5-li in the static area which is actually what the users see on their screen. We need a way to have a unique information transfered from the web component that we create (the ui5-menu-item) to the element that is dsplayed (here the ui5-li).

note: I am surprised that this does not come as a global requirement, we are just following the SAP guidelines & best practices, not doing some kind of crazy custom stuff :)

nnaydenow commented 1 month ago

Hi @Ilian-Allaf, @amaillard-sap,

Could you please check the following comment of @vladitasev in https://github.com/SAP/ui5-webcomponents/issues/7722 and if it will work for you? Seems like similar request.

BR, Nayden

amaillard-sap commented 1 month ago

Hi @nnaydenow,

I do not understand exactly what should be done based on the comment you linked.

I tried to use 'stable-dom-ref' on this stack blitz > https://stackblitz.com/edit/js-gq2yq1?file=index.js,index.html but I do not see any effect; can you assist us here ?

Thanks

nnaydenow commented 1 month ago

Hi @amaillard-sap,

I've prepared example with ui5-select: https://stackblitz.com/edit/js-jpva1i?file=index.js,index.html,package.json but it will required a downport for the Menu component. Could you please check if this will work for you and if yes, I'll prepare a downport?

amaillard-sap commented 1 month ago

Hi @nnaydenow,

I cannot say whether or not the companion / webassistant will be able to identify the select entry with this information, but this surely goes in the good direction :)

github-actions[bot] commented 2 weeks ago

Hello, everyone! The issue has been inactive for 21 days. If there are still questions or comments, please feel free to continue the discussion. Inactive issues will be closed after 7 days!

github-actions[bot] commented 1 week ago

Hello, everyone! The issue has been inactive for 28 days, so I am closing the issue.