fix: set cancelId to 1 when defaultId == 0 and no 'cancel' button (#17149)
This commit is contained in:
parent
08d8c16720
commit
36f7974e18
1 changed files with 2 additions and 1 deletions
|
@ -263,7 +263,8 @@ module.exports = {
|
||||||
|
|
||||||
// Choose a default button to get selected when dialog is cancelled.
|
// Choose a default button to get selected when dialog is cancelled.
|
||||||
if (cancelId == null) {
|
if (cancelId == null) {
|
||||||
cancelId = 0
|
// If the defaultId is set to 0, ensure the cancel button is a different index (1)
|
||||||
|
cancelId = (defaultId === 0 && buttons.length > 1) ? 1 : 0
|
||||||
for (let i = 0; i < buttons.length; i++) {
|
for (let i = 0; i < buttons.length; i++) {
|
||||||
const text = buttons[i].toLowerCase()
|
const text = buttons[i].toLowerCase()
|
||||||
if (text === 'cancel' || text === 'no') {
|
if (text === 'cancel' || text === 'no') {
|
||||||
|
|
Loading…
Reference in a new issue