gridsound / daw

GridSound (0.46.0) wants to be an open source online digital audio workstation following the new WebAudio API 🎛🎹🎵✨ -- If you can, please sponsor us a little on our Patreon ❤️
https://gridsound.com
GNU Affero General Public License v3.0
1.54k stars 131 forks source link

Alt key commands on mac #38

Open ethansilvas opened 6 years ago

ethansilvas commented 6 years ago

For some reason, when I try to use the alt key commands on mac they never work, even though my alt key works doing anything else. All of the commands that read "Ctrl/Alt" work if I use the control key, but never if I use the alt key. On my pc I don't have this issue, and I'm using chrome on both computers. Even when I tried plugging in a separate pc-layout keyboard into my mac, the commands still couldn't be read. Any reason this could be?

mr21 commented 6 years ago

Hi :) thanks for your issue

Initially there are ctrl and alt because sometime it is not possible to overwrite the a Ctrl shortcut like ctrl+N for example. But I don't remember about Mac's keyboard (im on PC). Currently I have no time anyway :/

joshnatis commented 4 years ago

Hi, just dropping in to say I'm still experiencing this behavior. Of course this is not at all an urgent issue, and I don't mean for this comment to be construed that way.

I think the code in /src/ui/keyboard.js may be responsible for this, specifically the function UIkeyboardShortcuts.

function UIkeyboardShortcuts( e ) {
    return UIkeyboardFns.some( ( [ ctrlOrAlt, alt, key, fn ] ) => {
        if ( ( key === e.key ) &&
            ( !alt || e.altKey ) &&
            ( ctrlOrAlt === ( e.ctrlKey || e.altKey ) )
        ) {
            fn();
            e.preventDefault();
            return true;
        }
    } );
}

Just to mention (may this be hinting at the problem somehow?), CTRL + Left-Click should equate to a Right-Click (it does in other tabs/windows), but this is not so in gridsound (it's just treated as Left-Click, as if CTRL's default behavior is prevented).

Cool project, thank you!