DEV: Do not delay DButton actions on iOS (#30322)
Followup to #28019, on iOS this delay means that we don't properly set focus on the composer.
This commit is contained in:
parent
415abe6491
commit
bcff64b9ab
|
@ -19,6 +19,7 @@ const ACTION_AS_STRING_DEPRECATION_ARGS = [
|
|||
|
||||
export default class DButton extends GlimmerComponentWithDeprecatedParentView {
|
||||
@service router;
|
||||
@service capabilities;
|
||||
|
||||
@notEmpty("args.icon") btnIcon;
|
||||
|
||||
|
@ -114,6 +115,7 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
|
|||
|
||||
_triggerAction(event) {
|
||||
const { action: actionVal, route, routeModels } = this.args;
|
||||
const isIOS = this.capabilities?.isIOS;
|
||||
|
||||
if (actionVal || route) {
|
||||
if (actionVal) {
|
||||
|
@ -129,19 +131,35 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
|
|||
);
|
||||
}
|
||||
} else if (typeof actionVal === "object" && actionVal.value) {
|
||||
// Using `next()` to optimise INP
|
||||
next(() =>
|
||||
if (isIOS) {
|
||||
// Don't optimise INP in iOS
|
||||
// it results in focus events not being triggered
|
||||
forwardEvent
|
||||
? actionVal.value(actionParam, event)
|
||||
: actionVal.value(actionParam)
|
||||
);
|
||||
: actionVal.value(actionParam);
|
||||
} else {
|
||||
// Using `next()` to optimise INP
|
||||
next(() =>
|
||||
forwardEvent
|
||||
? actionVal.value(actionParam, event)
|
||||
: actionVal.value(actionParam)
|
||||
);
|
||||
}
|
||||
} else if (typeof actionVal === "function") {
|
||||
// Using `next()` to optimise INP
|
||||
next(() =>
|
||||
if (isIOS) {
|
||||
// Don't optimise INP in iOS
|
||||
// it results in focus events not being triggered
|
||||
forwardEvent
|
||||
? actionVal(actionParam, event)
|
||||
: actionVal(actionParam)
|
||||
);
|
||||
: actionVal(actionParam);
|
||||
} else {
|
||||
// Using `next()` to optimise INP
|
||||
next(() =>
|
||||
forwardEvent
|
||||
? actionVal(actionParam, event)
|
||||
: actionVal(actionParam)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (route) {
|
||||
if (routeModels) {
|
||||
|
|
Loading…
Reference in New Issue