vaadin/flow-components

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

web-padawan opened this issue · 0 comments

Describe your motivation

Originally requested by @knoobie in #6473 (comment)

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)