Code Monkey home page Code Monkey logo

Comments (3)

kumar-ish avatar kumar-ish commented on August 10, 2024

I believe this is because Macs transform combinations of keys and Option to not-those-characters (I can't exactly tell what this feature is called, but it's the same thing as being described in this StackOverflow post) -- e.g. if I press down on (in this textarea, on Github) Option + S on my Mac, I get ß.

So when the downforacross.com frontend is reading the key property of that key press event, it's detecting the key as ß. These lines are the ones that have to be changed (in the hackiest way possible in that SO post I linked) are here.

from downforacross.com.

kumar-ish avatar kumar-ish commented on August 10, 2024

AFAICT, there's no way for Macs to not do that (i.e. it's not like we can disable that on the browser level, and handle it the same way that we're doing now). Note that there's also a different set of transformations that happen for Option+Shift+key's.

I would recommend that we just add those transformations (i.e. for S, W and P respectively -- ß, ∑, π when pressing Option, and Í, „, and ∏ when pressing Option+Shift -- this is the case in most of the English keyboards available (i.e. everything but Irish and Indian)) in the lines in those permalinks. Seeing as those are not valid characters in crosswords anyways, there should be no conflict with other parts of the codebase.

The other alternative would be to simply change the shortcuts. However, some people would be used to the existing behaviour, and would need to learn the changed ones. So this previous option is non-invasive to existing users.

I've added / tested those changes in this branch, if the former behaviour is desirable.

from downforacross.com.

mjbaldwin avatar mjbaldwin commented on August 10, 2024

Yup. In case it helps, since I'm assuming you're not on Macs -- I used this link to generate a series of keyboard events for Opt+S on my Mac in Chrome:

image

And for Opt+Shift+S:

image

I think your approach will work fine.

The alternative approach would be to use the "code" instead of the "key", will still returns the unmodified "S" in this case, possibly around line 279:

if (_handleKeyDown(ev.key, ev.shiftKey, ev.altKey)) {

I'm not sure if that would break other things that depend on existing behavior though.

from downforacross.com.

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.