Description
MDCDialog uses focus trap as well explained here
This make the first focusable element of the dialog focused.
But the documentation about the default action says "MDC Dialog supports indicating that one of its action buttons represents the default action, triggered by pressing the Enter key. "
Obviously with the first focusable element behavior this is contradictory.
So I suggest that, when a default action button is configured, the mdc-dialog__button--default
is set, that the initial focused element become the default action button.
It looks like MDCDialog
constructor accepts the initial element to be passed as argument, which would workaround the issue. The proposal here is to make it defaults to the default action button
A fallback tree could looks like this:
- given element in constructor
- default action button
- focus-trap default (first focusable element)
Best of both worlds! Thanks!