-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Closed
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/bottom-sheetarea: material/dialog
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Type declaration differs from documentation.
restoreFocus should allow boolean, string or HTMLElement, but does only allow boolean values.
If you use any to overwrite the type check it works with string and HTMLElement.
https://material.angular.dev/cdk/dialog/overview#focus-restoration
components/src/material/dialog/dialog-config.ts
Lines 133 to 136 in c7cc0be
| * Whether the dialog should restore focus to the | |
| * previously-focused element, after it's closed. | |
| */ | |
| restoreFocus?: boolean = true; |
Reproduction
Steps to reproduce:
- Inject MatDialog
- Try using
matDialog.open(ref, { restoreFocus: 'some-selector' })
Expected Behavior
Should work with boolean, string or HTMLElement.
Actual Behavior
Expect only boolean.
Environment
Angular CLI : 21.1.4
Angular : 21.1.4
Node.js : 20.19.5
Package Manager : npm 10.8.2
Operating System : win32 x64
┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations │ 21.1.4 │ ~21.1.4 │
│ @angular/aria │ 21.1.4 │ ~21.1.4 │
│ @angular/build │ 21.1.4 │ ~21.1.4 │
│ @angular/cdk │ 21.1.4 │ ~21.1.4 │
│ @angular/cli │ 21.1.4 │ ~21.1.4 │
│ @angular/common │ 21.1.4 │ ~21.1.4 │
│ @angular/compiler │ 21.1.4 │ ~21.1.4 │
│ @angular/compiler-cli │ 21.1.4 │ ~21.1.4 │
│ @angular/core │ 21.1.4 │ ~21.1.4 │
│ @angular/forms │ 21.1.4 │ ~21.1.4 │
│ @angular/material │ 21.1.4 │ ~21.1.4 │
│ @angular/platform-browser │ 21.1.4 │ ~21.1.4 │
│ @angular/platform-browser-dynamic │ 21.1.4 │ ~21.1.4 │
│ @angular/router │ 21.1.4 │ ~21.1.4 │
│ rxjs │ 7.8.2 │ ~7.8.2 │
│ typescript │ 5.9.3 │ ~5.9.3 │
│ zone.js │ 0.15.1 │ ~0.15.0 │
└───────────────────────────────────┴───────────────────┴───────────────────┘
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/bottom-sheetarea: material/dialog