Skip to content

Conversation

@thibaultzanini
Copy link
Collaborator

  • Add debounced interaction management to Target
  • Add debouncing functionality to Button component

@thibaultzanini thibaultzanini requested a review from marchant April 15, 2025 15:42
@thibaultzanini thibaultzanini self-assigned this Apr 15, 2025
}
}

_updateActionDebounceRegistration() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marchant if you come up with a better name

* @type {Map<string, number>}
* @private
*/
__debouncedInteractionThresholds: { value: null },
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marchant if you come up with a better name

this._debouncedInteractionTimestamps.delete(interactionKey);
}

shouldPreventInteraction(interactionKey) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marchant if you come up with a better name

this.active = false;
this.dispatchActionEvent();

if (!this.shouldPreventInteraction("action")) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marchant I tried to add it to the press composer and the key composers and it worked fine only when the source was the same composer.
Meaning, an interaction from the press composer and the key composer during the debouncing window will cause 2 action events. So, I added the logic to Target and it's managed by the button itself. I also have a version working for the press composer and the key composer but that would be for another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants