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

space key handed down to calendar while typing a date

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.0.0
    • 8.6.2
    • Components
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      <datebox open="true" format="yyyy MM dd"/>
      

      focus the datebox start typing a date (don't close the popup)
      e.g. try typing: 2019[SPACE]01[SPACE]01

      Current Result

      after pressing space the date is completed with the current date, then the SPACE is appended to the end

      Expected Result

      append a SPACE the value typed

      Debug Info

      SPACE triggers a selection in the calendar popup like clicking a date which doesn't make sense when typing a date manually

      ARROW keys are arguable: I quite like the fact that starting to use ARROW keys moves the focus down to the calendar popup after that direct typing is no longer enabled so that SPACE can continue to behave normally

      Root Cause

      Datebox._doKeyDown has special handling for ENTER/ESC but misses to avoid sending the SPACE character down to the popup, while still typing

      Workaround

      don't handle SPACE (32) as a special key while typing in the datebox

          zk.afterLoad('zul.db', function() {
              var xDatebox = {};
              zk.override(zul.db.Datebox.prototype, xDatebox, {
                  _doKeyDown : function(evt) {
                      if (evt.keyCode !== 32) {
                          xDatebox._doKeyDown.apply(this, arguments);
                      }
                  }
              });//zk.override
          });//zk.afterLoad
      

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

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h