Git Product home page Git Product logo

Comments (9)

bvaughn avatar bvaughn commented on May 5, 2024

Ah, right. Currently it is not possible to disable keyboard scrolling for a VirtualScroll component. I could add such a feature if needed but I don't think you need it in this case. In your keyboard event handler, if you decide that an event has meaning (like an up/down arrow), then you can stop it from bubbling up to VirtualScroll like so:

event.preventDefault()
event.stopPropagation()

from react-virtualized.

bvaughn avatar bvaughn commented on May 5, 2024

Going to close this as answered for now. Please let me know if you still have questions though :)

from react-virtualized.

 avatar commented on May 5, 2024

Yeah no worries abwt closing it :)
I'm not sure though i understand how I would implement the bubbling of the event. I do not currently have an keyboard event handler.
Could u provide a sample case? Pseudo code would do :)

from react-virtualized.

bvaughn avatar bvaughn commented on May 5, 2024

Ah, I see.

I am suggesting that you could listen for the event you care about (in this case the keyboard event) and prevent it from getting up to the VirtualScroll parent if you want to prevent the default behavior.

from react-virtualized.

 avatar commented on May 5, 2024

yeah but that's annoying cuz then i'd need to pass it to the other library i want to listen to that even.
What if i did a manual disable of that in the react-virtualized source code? Is there a method that if removed would disable the even listening?

from react-virtualized.

bvaughn avatar bvaughn commented on May 5, 2024

No, you wouldn't. You could just wrap the other library you're using and stop up/down arrow events from bubbling up any further. Something like...

<VirtualScroll>
  <div onKeyDown={yourEventHandler}>
    <TheOtherLibrary/>
  </div>
</div>

from react-virtualized.

jquense avatar jquense commented on May 5, 2024

I'm taking a look at using the VirtualScroll component but the lack of bubbling events is a dealbreaker. IN our case I need the key events to propagate to a higher component that manages state like the currently selected cell, (think like excel's keyboard navigation). I appreciate the value that the keyboard scroll adds...is the stopPropagation necessary? PreventDefault should already kill any scroll behavior no?

from react-virtualized.

bvaughn avatar bvaughn commented on May 5, 2024

Good suggestion, @jquense. I believe you're right. :)

from react-virtualized.

bvaughn avatar bvaughn commented on May 5, 2024

@jquense check out 4.6.1. I've removed stopPropagation and left preventDefault as you suggested.

from react-virtualized.

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.