-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Group events into a single enum #2279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a great idea. I have merged HEAD into te PR to leverage #2278, showing the events.json has no diffs.
packages/grid/_modules_/grid/hooks/features/clipboard/useGridClipboard.ts
Outdated
Show resolved
Hide resolved
@@ -112,7 +107,7 @@ export const useGridKeyboard = (apiRef: GridApiRef): void => { | |||
} | |||
|
|||
if (isNavigationKey(event.key) && !isSpaceKey(event.key) && !event.shiftKey) { | |||
apiRef.current.publishEvent(GRID_COLUMN_HEADER_NAVIGATION_KEY_DOWN, params, event); | |||
apiRef.current.publishEvent(GridEvents.cellNavigationKeyDown, params, event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should have been:
apiRef.current.publishEvent(GridEvents.cellNavigationKeyDown, params, event); | |
apiRef.current.publishEvent(GridEvents.columnHeaderNavigationKeyDown, params, event); |
The keyboard navigation is no longer working on the header https://codesandbox.io/s/material-demo-forked-git2x
Breaking changes
Part of #2227
With #2278 there is no change in the documentation output.
Several benefits here :
publishEvent
/subscribeEvent
(they will be able to import the enum instead of having floating strings as keysDo we want the user to use directly the string (like in https://github.com/mui-org/material-ui-x/blob/master/docs/src/pages/components/data-grid/events/SubscribeToEvents.tsx#L16) or do we want them to import the constant (like in https://github.com/mui-org/material-ui-x/blob/master/docs/src/pages/components/data-grid/editing/CatchEditingEventsGrid.tsx#L25)
If we want him to import the enum, could we type
publishEvent
/subscribeEvent
first param accordingly ?