From 6a889d06ac1de21c6274b90ef6763a080cd20e10 Mon Sep 17 00:00:00 2001 From: jamsonchan Date: Fri, 8 Dec 2023 18:41:11 +0800 Subject: [PATCH] ZK-5517: unable to change the current year with a keyboard --- zkdoc/release-note | 1 + zktest/src/main/webapp/test2/B100-ZK-5517.zul | 16 ++++++++++++++++ zktest/src/main/webapp/test2/config.properties | 1 + zul/src/main/resources/web/js/zul/db/Calendar.ts | 9 +++++++++ 4 files changed, 27 insertions(+) create mode 100644 zktest/src/main/webapp/test2/B100-ZK-5517.zul diff --git a/zkdoc/release-note b/zkdoc/release-note index 4605de95706..f1a2691b407 100644 --- a/zkdoc/release-note +++ b/zkdoc/release-note @@ -10,6 +10,7 @@ ZK 10.0.0 ZK-5476: client mvvm failed for a tree ZK-5037: invisible first column hides checkmarks in a listbox ZK-5535: TrackerImplEx#removeAllReference accesses map value by iteration instead of key, lowers performance + ZK-5517: unable to change the current year with a keyboard * Upgrade Notes + Upgrade commons-fileupload to commons-fileupload2-javax 2.0.0-M1 and commons-io to 2.13.0 to support jakarta-friendly uploads diff --git a/zktest/src/main/webapp/test2/B100-ZK-5517.zul b/zktest/src/main/webapp/test2/B100-ZK-5517.zul new file mode 100644 index 00000000000..a3e6c4634c9 --- /dev/null +++ b/zktest/src/main/webapp/test2/B100-ZK-5517.zul @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/zktest/src/main/webapp/test2/config.properties b/zktest/src/main/webapp/test2/config.properties index 8d61cb7b5e0..f2901b05ada 100644 --- a/zktest/src/main/webapp/test2/config.properties +++ b/zktest/src/main/webapp/test2/config.properties @@ -3164,6 +3164,7 @@ B90-ZK-4431.zul=A,E,Multislider ##zats##B100-ZK-5037.zul=A,E,Listbox,Listheader,Checkmark,invisible ##zats##B100-ZK-5393.zul=A,E,FileUpload,JakartaEE ##zats##B100-ZK-5535.zul=A,E,performance,tree,mvvm,trackerNode,treeModel +##zats##B100-ZK-5517.zul=A,E,calendar,year,keyboard ## # Features - 3.0.x version diff --git a/zul/src/main/resources/web/js/zul/db/Calendar.ts b/zul/src/main/resources/web/js/zul/db/Calendar.ts index 575291f8170..281f8e1b2dd 100644 --- a/zul/src/main/resources/web/js/zul/db/Calendar.ts +++ b/zul/src/main/resources/web/js/zul/db/Calendar.ts @@ -675,6 +675,15 @@ export class Calendar extends zul.Widget { /** @internal */ override doKeyDown_(evt: zk.Event): void { + + // ZK-5517: unable to change the current year with a keyboard + if (evt.shiftKey) { + const view = this._view; + this._view = 'year'; + this._shift(evt.key === 'PageUp' ? 1 : evt.key === 'PageDown' ? -1 : 0); + this._view = view; + } + var keyCode = evt.keyCode, ofs = keyCode == 37 ? -1 : keyCode == 39 ? 1 : keyCode == 38 ? -7 : keyCode == 40 ? 7 : 0; if (ofs) {