Code Monkey home page Code Monkey logo

Comments (5)

romgrk avatar romgrk commented on August 24, 2024 2

But it would be incorrect. E.g. in dvorak layout, the physical V key corresponds to the logical X symbol. So a dvorak user pressing Ctrl + X (in their layout) might have the event.code as KeyV.

from mui-x.

gitstart avatar gitstart commented on August 24, 2024 1

@michelengelen we would like to pick this up

from mui-x.

romgrk avatar romgrk commented on August 24, 2024 1

@shaharyar-shamshi You can open a PR with the fix. I would avoid event.code, according to the spec .code represents a physical key, which might not match with the logical key for unusual keyboard layouts.

from mui-x.

shaharyar-shamshi avatar shaharyar-shamshi commented on August 24, 2024

@michelengelen I would like to pick up this issue.

after initial checking I found out when caps lock is on CTRL + v becomes CTRL + V

So this

function isPasteShortcut(event: React.KeyboardEvent) {

code will not work as it checking for lowercase v only

corrected version of code will be

const isPasteShortcut = (event: React.KeyboardEvent) => {
  return (
    (event.ctrlKey || event.metaKey) &&
    (event.key.toLowerCase() === 'v' || event.code.toLowerCase() === 'keyv')
  );
};

If you can assign this to me

from mui-x.

shaharyar-shamshi avatar shaharyar-shamshi commented on August 24, 2024

@shaharyar-shamshi You can open a PR with the fix. I would avoid event.code, according to the spec .code represents a physical key, which might not match with the logical key for unusual keyboard layouts.

Yes I agree but it is in or condition to be on safer side I included 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.