PERF: Defer button actions to improve interaction-next-paint (INP) (#28019)

This is a variation on bc3e8a9963cf9a64d114ec751c875025af169690, which was reverted due to issues on iOS. Safari's "in response to user action" check cannot follow the `runAfterFramePaint` chain of interaction -> requestAnimationFrame -> messageChannel, and so some sensitive browser APIs (e.g. clipboard, upload, etc.) were blocked.

This commit is similar, but uses `next()` instead of `runAfterFramePaint()`. The result seems the same, but doesn't have the same issue on iOS.

The chat-emoji-picker change was required to resolve a test failure. The emoji picker has never closed-on-scroll on desktop, so there is no user-facing change in behavior.
This commit is contained in:
David Taylor
2024-08-20 03:11:34 +01:00
committed by GitHub
parent 1446596089
commit dfc947a97d
3 changed files with 24 additions and 18 deletions

View File

@ -13,6 +13,10 @@ export default class ChatChannelMessageEmojiPicker extends Component {
context = "chat-channel-message";
listenToBodyScroll = modifier(() => {
if (!this.site.mobileView) {
return;
}
const handler = () => {
this.chatEmojiPickerManager.close();
};
@ -43,10 +47,6 @@ export default class ChatChannelMessageEmojiPicker extends Component {
{
placement: "top",
modifiers: [
{
name: "eventListeners",
options: { scroll: false, resize: false },
},
{
name: "flip",
options: { padding: { top: headerOffset() } },