flow-components
flow-components copied to clipboard
[dialog, popover] Add enums for setOverlayRole() methods
Describe your motivation
Originally requested by @knoobie in https://github.com/vaadin/flow-components/pull/6473#discussion_r1756388008
I'm wondering if this should be an enum on the flow side with both possible values (dialog / alertdialog) to ensure the typical type safety on java side.. those values don't change often and people could theoretically always use the element API if a new value comes out of the blue and you could not update in time.
Describe the solution you'd like
Add some enums like DialogOverlayRole (name to be decided) and overrides for setOverlayRole() methods so that users could use them instead of strings e.g. like this:
dialog.setOverlayRole(DialogOverlayRole.ALERTDIALOG);
Additional context
The following roles are generally expected to be supported:
Dialog: onlydialogandalertdialogPopover:dialog,menu,listbox,grid,tree(see docs)