Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4370

copy to clipboard from listbox (interrupted)

XMLWordPrintable

    • ZK 9.0.1 S1

      Steps to Reproduce

      <zk>
          <listbox>
              <listitem><listcell label="Some text to copy"/><listcell label="Some text to copy"/><listcell label="Some text to copy"/></listitem>
              <listitem><listcell label="Some text to copy"/><listcell label="Some text to copy"/><listcell label="Some text to copy"/></listitem>
              <listitem><listcell label="Some text to copy"/><listcell label="Some text to copy"/><listcell label="Some text to copy"/></listitem>
          </listbox>
      </zk>
      
      1. Select/highlight text using the mouse.
        1. select text within a single row OR
        2. select text over multiple rows
      2. Press Ctrl-C to copy the highlighted text to clipboard.

      Current Result

      varying browser behavior
      Chrome:

      • single row: when holding CTRL the selection disappears (when releasing CTRL the selection is restored) -> making it impossible to complete CTRL-C to copy
      • multiple rows: works in Chrome

      FireFox:

      • the selection is immediately removed after releasing the mouse

      Expected Result

      allow copying of text contents in a listbox
      consistent browser behavior
       

      Debug Information

      https://github.com/zkoss/zk/blob/v8.6.2/zul/src/archive/web/js/zul/sel/SelectWidget.js#L606-L652

      The code clearly disables selection on keydown event, without giving a reason in the comments.

      Workaround

      for chrome (ignore control/meta/alt key in the keydown method):

      http://zkfiddle.org/sample/3a2ddud/2-user-select-none-alt-tab

      all browsers:
      using <listbox nonselectableTabs="*"/> doesn't interfere with copy/paste any more

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: