flow-components icon indicating copy to clipboard operation
flow-components copied to clipboard

[dialog, popover] Add enums for setOverlayRole() methods

Open web-padawan opened this issue 1 year ago • 0 comments

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: only dialog and alertdialog
  • Popover: dialog, menu, listbox, grid, tree (see docs)

web-padawan avatar Sep 17 '24 07:09 web-padawan