Giter Club home page Giter Club logo

Comments (16)

simonv3 avatar simonv3 commented on May 28, 2024

Heh, just read the documentation. Already implemented :P

from quickmockup.

simonv3 avatar simonv3 commented on May 28, 2024

Oh wait. Is this the "del" key on a Windows keyboard? This doesn't work with a Mac's delete key (which is also the backspace key).

from quickmockup.

jdittrich avatar jdittrich commented on May 28, 2024

Ah, interesting. Don't have a mac around at the moment. Do Mac users expect objects to delete on backspace? If yes, we could implement this – (FYI this is where the event binding magic happens and this is mousetrap, the library I used, just in case you want to give it a go)

from quickmockup.

simonv3 avatar simonv3 commented on May 28, 2024

the backspace button is called "delete" so I assume so :P.

I'll give it a go when I come back from dinner (or maybe tomorrow, but I definitely won't mind digging into the code for this).

from quickmockup.

jdittrich avatar jdittrich commented on May 28, 2024

TLDR; On (my) mac (/firefox) the backspace is also mapped to the browser's back function.

What should happen: delete the element
What happens instead: deletes the element and (wants to go back and) asks if I want to leave the page.

Solutions:

  • prevent the default action (may make sense for these in general, also a windows user is unlikely to want to navigate away by backspace (if that key binding is existing there?)
  • use other key

from quickmockup.

simonv3 avatar simonv3 commented on May 28, 2024

Out of curiousity, is this a binding you added yourself? My Firefox doesn't do that.

from quickmockup.

jdittrich avatar jdittrich commented on May 28, 2024

Hmm, did not change anything as far as I remember. Are there other Mac-People around who might enlighten us? (And does that keybinding exist in other browsers too?)

from quickmockup.

paulproteus avatar paulproteus commented on May 28, 2024

from quickmockup.

jdittrich avatar jdittrich commented on May 28, 2024

@paulproteus: Thanks! Thats a great thing to know.

I'm unsure of how to proceed – we could:

  • Set up an alternative, unambigous delete key
  • Your ideas...

from quickmockup.

simonv3 avatar simonv3 commented on May 28, 2024

Hmm, maybe I did a mapping?

Maybe just "d"?

Or we overwrite the behavior. Since it's a webapp that mimics drawing and design apps like Photoshop, Sketch, and Illustrator, I don't think using the "delete/back" key for this purpose is wrong. The question I guess is - are users expecting their browser to act as browsers, or are they expecting standard app functionality?

From that SE:

var hasfocus = 'false';

// when focus happens, set a variable
$(document).on('focusin','input, textarea',function() {
    hasfocus = 'true';
    });

// unset when focus is not happening    
$(document).on('focusout','input, textarea',function() {
    hasfocus = 'false';
    });

// if not in a form field, stop backspace and delete default action
$(document).keypress(function (e) {
    if(e.which == 8 || e.which == 46) {
        if(hasfocus == 'false') {
            e.preventDefault();
           }
       }
    });

from quickmockup.

jdittrich avatar jdittrich commented on May 28, 2024

are users expecting their browser to act as browsers, or are they expecting standard app functionality?

Good question.

I just tried with yahoo mail, they use it as a delete key.

Though I agree with the stackexcange person saying that it is usually not a great idea to block the keys, we already break the behaviour with the "are you sure you want to leave" message, so remapping would not do too much additional harm but some additional good here.

  • See some other webapps
  • Is the above mentiones block-shortcut function possibly already part of the library we use, moustrap? Yes,seemingly it is. See the linked page, Headline: Stopping the default behavior

from quickmockup.

paulproteus avatar paulproteus commented on May 28, 2024

from quickmockup.

simonv3 avatar simonv3 commented on May 28, 2024

@asheesh, I think you need to inform the masses on GitHub that +1 implies you'll do something about it :P

from quickmockup.

jdittrich avatar jdittrich commented on May 28, 2024

check the most current version (the one on the demopage e.g.) and see if it works (it does for me).

from quickmockup.

simonv3 avatar simonv3 commented on May 28, 2024

Yep, that works for me!

Edit: Confirmed, both Chrome and Firefox

from quickmockup.

jdittrich avatar jdittrich commented on May 28, 2024

I close this optimistically. We can still reopen if virtual stuff explodes :)

from quickmockup.

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.