ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

Cannot add data automation id property to MenuItem

Open Ilian-Allaf opened this issue 1 year ago • 9 comments
trafficstars

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

  • [X] I’m not disclosing any internal or sensitive information.

Ilian-Allaf avatar May 27 '24 13:05 Ilian-Allaf

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

plamenivanov91 avatar May 29 '24 07:05 plamenivanov91

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.

amaillard-sap avatar May 29 '24 15:05 amaillard-sap

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

plamenivanov91 avatar May 29 '24 15:05 plamenivanov91

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 :)

amaillard-sap avatar May 29 '24 15:05 amaillard-sap

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

nnaydenow avatar May 29 '24 23:05 nnaydenow

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

amaillard-sap avatar Jun 07 '24 09:06 amaillard-sap

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?

nnaydenow avatar Jun 10 '24 07:06 nnaydenow

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 :)

amaillard-sap avatar Jun 10 '24 08:06 amaillard-sap

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] avatar Jul 02 '24 00:07 github-actions[bot]

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

github-actions[bot] avatar Jul 09 '24 00:07 github-actions[bot]