Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update event spec #78

Merged
merged 5 commits into from
Oct 25, 2023
Merged

Update event spec #78

merged 5 commits into from
Oct 25, 2023

Conversation

almarklein
Copy link
Member

Closes #56

  • Add buttons prop to wheel event.
  • Add time_stamp to all events.
  • Document pointer_id better.

@almarklein
Copy link
Member Author

I should still test the new buttons prop, but I don't have a mouse where I am right now.

@almarklein almarklein mentioned this pull request Oct 24, 2023
@almarklein
Copy link
Member Author

Interesting how the buttons field for wheel event does not even work on Firefox (it's always zero). Was easy to fix though, so our event system should consistently support it.

@Korijn
Copy link

Korijn commented Oct 24, 2023

LGTM!

@@ -254,6 +257,7 @@ export class RemoteFrameBufferView extends DOMWidgetView {

// Scrolling. Need a special throttling that accumulates the deltas.
// Also, only consume the wheel event when we have focus.
// On Firefox, e.buttons is always 0 for wheel events, so we use a cached value for the buttons.
Copy link

@Korijn Korijn Oct 25, 2023

Choose a reason for hiding this comment

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

I read this on MDN under the section Firefox notes:

On Mac OS X 10.5, the buttons attribute always returns 0 because there is no platform API for implementing this feature.

So it seems you happened upon a very specific corner case. Maybe you only want to use the cached value if the buttons attribute equals zero?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, that explains it. Though surprising that Firefox does not fake it a way similar to what we do here.

I'd rather just use the cached value always, for consistency/simplicity.

Copy link

Choose a reason for hiding this comment

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

I'm concerned it's going to be inaccurate though. If I hold my mouse buttons, move out of the window, release the buttons, move back into the window and scroll the wheel, will the values be correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that should work correctly because of mouse capturing. Every mouse down should be followed by a mouse up.

Copy link
Member Author

Choose a reason for hiding this comment

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

@almarklein almarklein merged commit d737dde into main Oct 25, 2023
7 checks passed
@almarklein almarklein deleted the events branch October 25, 2023 07:48
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.

Event improvements
2 participants