Multiple Selection on Macs not-working

4 posts, 0 answers
  1. Kevin Wood
    Kevin Wood avatar
    4 posts
    Member since:
    May 2007

    Posted 27 Jul 2010 Link to this post

    I was made aware of the Multiple Selection on Macs not working for the RadListBox - when trying to use the Command (Control-equivalent on PC)-Click combination.

    The Shift-Click combination works fine - for selecting multiple items in a row.

    The Command-Click - cherry picking method for multiple selection does not work. I am trying this on Safari, and it did not work on the Telerik Demo application. I was also told that this is non-working on Firefox.

     http://demos.telerik.com/aspnet-ajax/listbox/examples/default/defaultcs.aspx

    For sanity purposes, I used a standard asp.net listbox control, and the multiple selection with Command-Click works fine.

    I searched the forums, but did not find any reference to this. Is this a known issue?


  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 03 Aug 2010 Link to this post

    Hello Kevin Wood,

    I have spent quite awhile time to research the nature of this problem and here is the result.

    The problem here is that the browsers don't raise any flag in JavaScript to notify that the command button is pressed. Therefore our controls can never know if a command button is pressed.

    The default asp:ListBox works with this, because it doesn't have any client-side api and depends only to the default behavior of the native html elements to which it's rendered. Having that the browser knows about command button (even thought it doesn't tell anyone about it's pressing), there is no problem to use it (the browser interprets the actions over the native html elements without using JavaScript in the middle and handles them).
    Here is a reference for keystroke detection, which clearly states it's undetectable:
    http://www.quirksmode.org/js/keys.html

    Summary:
    The browser knows about command pressing, but unfortunately the JavaScript doesn't. That's why, we can not handle such case.


    Regards,
    Nikolay Tsenkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian
    Brian avatar
    1 posts
    Member since:
    May 2009

    Posted 27 Aug 2010 Link to this post

    What about this:

    ns4 = (document.layers) ?1:0;
    ie4 = (document.all) ?1:0;
    dom = (document.getElementsById) ?1:0;
    if (ns4) document.captureEvents(Event.KEYDOWN);
    document.onkeydown = keyDown;
    window.onkeydown = keyDown;
    function keyDown(e) {
       var keyPress = (ie4) ? window.event.keyCode : e.which ;
       shft = ((ns4) ? e.modifiers && Event.SHIFT_MASK   :
    window.event.shiftKey) ? " shft " :"";
       alt  = ((ns4) ? e.modifiers && Event.ALT_MASK     :
    window.event.altKey)   ? " alt "  :"";
       ctrl = ((ns4) ? e.modifiers && Event.CONTROL_MASK :
    window.event.ctrlKey)  ? " ctrl " :"";
       meta = ((ns4) ? e.modifiers && Event.META_MASK    :
    window.event.metaKey)  ? " meta " :"";
       var key = String.fromCharCode(keyPress);
       window.status= key + ' (' +keyPress + ') ' + shft + ' ' + alt + ' '
    + ctrl + ' ' + meta;
       return false;

    This is what is displayed in the status bar when I press the Mac
    Command key with the above Javascript code:

    (91)

    So looking for keycode 91 does seem to be a reliable way of detecting
    the Command keypress itself.

    <script>
    // simplified to handle IE only
      
    var commandkey = false;
      
    function keyDown() { 
      if (event.keyCode == 91) commandkey = true;
    }
    document.onkeydown = keyDown; 
      
    function keyUp() {
      if (event.keyCode == 91) commandkey = false;
    }
    document.onkeyup = keyUp; 
      
    function checkcommand() {
      alert(commandkey ? "command key pressed!" : "command key NOT
    pressed");
    }
    </script>
      
    <a href=# onclick="checkcommand()">click me</a>

    Asides: For IE-Windows, this detects whether the Windows key is being
    pressed. There is a danger of the commandkey variable getting out of
    sync with the actual state of the commandkey if the focus is not on
    the browser window when the command key is pressed or released.

  5. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 01 Sep 2010 Link to this post

    Hi Brian,

    I have made a new research about this problem.

    At first, even pretty hard it seemed possible to solve.
    I have tried using only key combinations to detect the command key and found out that in:
    - Opera - it's detectable with keyCode 17 (makes it impossibleto detect because it's a regular key not modifier);
    - FF - it's detectable through the metaKey property of the event object (still no reason to be impossible);
    - In IE - it's with keyCode 91 (makes it impossible to detect because it's a regular key not modifier);
    - In Safari it's not always updated, but in combination with actual key ("command" is modifier) it's state was detectable again through the metaKey property of the event object (still no reason to be impossible).

    And here comes the part that the handling of this modifier's holding state becomes totally impossible:
    - On click event the state of this key isn't updated (e.g. holding "command" and click on item of the ListBox) - the metaKey is always false - FF, Safari. And since in the IE and Opera it's handled like a regular key, not like a modifier, we can not check it's state either. Therefore it's (as said in the quirksmode.org) undetectable for this scenario.

    I hope you understand why we can not implement support for this key modifier, and that it will not be too inconvenient for the user-group of your projects!


    Regards,
    Nikolay Tsenkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top