Giter Site home page Giter Site logo

Comments (3)

michelengelen avatar michelengelen commented on July 17, 2024

Hey @mogrady88,
I tried replicating your described behaviour, but wasn't able to do so. It seems there is something more going on in your component that I am not aware of.

Could you please provide a minimal reproduction test case with the latest version. This would help a lot 👷.

A live example would be perfect. You can find a examples and guides on how to find templates in our docs with which you can provide examples for your specific use-case: Support - Bug reproduction.

Thank you! 🙇🏼

from mui-x.

mogrady88 avatar mogrady88 commented on July 17, 2024

Hey Michel, you are right. The issue turned out to be my own. We're trying to implement a custom checkAll header with some additional functionality and it looks like there are some limitations around keyboard events. This source code reads like you short circuit keyboard events from custom renderHeader components unless its of type __check__.

Our current solution is to define a column with a field: 'custom' and then subscribe to columnHeaderKeyDown and manually handle the ArrowRight, ArrowLeft, and ArrowDown eventing. I havent seen any clean example of a DataGrid with checkboxSelection that includes a custom renderHeader

Do you have any advice on how to drill keyboard events to a ColDef with a field of __check__ and a renderHeader component? The simplest reproduction would be to add a renderHeader: () => <Button onClick={() => console.log('clicked'}>Click Me</Button>. If I navigate via keyboard to that header and try to activate the button with Space or Enter no event comes through and that onClick doesnt fire.

from mui-x.

michelengelen avatar michelengelen commented on July 17, 2024

Well ... for the keyboard navigation to work you would need to handle key strokes inside the rendered header on your own. I did test it with a simple button and pressing space or enter did fire the onClick event just fine (screencast below).\

Screen.Recording.2024-04-03.at.12.11.57.mov

The underlying problem why the keyboard navigation is no longer working is that the button receives focus and traps it. The events for arrows need to be bubbled to the parent container, so that they can act upon it.

from mui-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.