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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

table: Correct onRow event handlers to receive a MouseEvent #18910

Merged
merged 1 commit into from Sep 20, 2019

Conversation

TLadd
Copy link

@TLadd TLadd commented Sep 19, 2019

... instead of a SyntheticEvent

馃 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

馃敆 Related issue link

馃挕 Background and solution

The definition for the table events supplied in onRow is currently defined as a SyntheticEvent, but it can be more specific. All of those event handlers receive a MouseEvent. Can confirm that by viewing the React types and all of these event handlers show are typed as MouseEventHandler https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L1339. MouseEvent gives you access to things like e.ctrlKey and other mouse-specific fields. Our use-case that required this was opening a page in a new tab when a row is cmd-clicked.

馃摑 Changelog

Language Changelog
馃嚭馃嚫 English Corrected the TableEventListeners type to receive React.MouseEvent instead of the more generic React.SyntheticEvent
馃嚚馃嚦 Chinese

鈽戯笍 Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • [] Changelog is provided or not needed

@netlify
Copy link

netlify bot commented Sep 19, 2019

Deploy preview for ant-design ready!

Built with commit f6b0215

https://deploy-preview-18910--ant-design.netlify.com

@codecov
Copy link

codecov bot commented Sep 19, 2019

Codecov Report

Merging #18910 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #18910   +/-   ##
=======================================
  Coverage   96.92%   96.92%           
=======================================
  Files         281      281           
  Lines        7548     7548           
  Branches     2106     2061   -45     
=======================================
  Hits         7316     7316           
  Misses        230      230           
  Partials        2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 974fb1b...f6b0215. Read the comment docs.

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.

None yet

3 participants