Tk Library Source Code

View Ticket
Login
Ticket UUID: 2f7e44b702e9df6bfe07120d5cc0632b677f865
Title: datefield: bugs found by the new tests (Shift-Tab, plus/minus with Tk 9, invalid date with Tcl 8.6)
Type: Bug Version: trunk
Submitter: serhiy.storchaka Created on: 2026-11-21 18:08:47
Subsystem: tklib :: datefield Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-11-22 15:52:43
Resolution: None Closed By: nobody
    Closed on:
Description:

The bugs below were found by the tests in branch tests-datefield; each is covered by a test with the knownBug constraint (datefield-3.21, datefield-6.3, datefield-6.13, datefield-6.14.1).

  • Shift-Tab does not move to the previous field. KeyPress handles Shift-Tab only in the Tab case (by testing the Shift bit of the state), but on X11 Shift-Tab is reported with the keysym ISO_Left_Tab, which is not handled. The event falls through to the default bindings, which move the focus to the previous widget (with a single widget, the insertion cursor ends at position 10). Expected: from the year to the second field and then to the first field, in all formats. Tk 8.6 and 9.1, tests datefield-6.13 (English) and datefield-6.14.1 (ISO).
  • The + and - keys do not change the day with Tk 9. KeyPress compares %K with plus and minus, but with Tk 9 %K is the character itself (+, -) for printable keysyms, so the keys are refused as non-digits and the bell rings. Tk 9.1, test datefield-6.3.
  • Changing the year can leave an invalid date. The new year is validated only with clock scan, which in Tcl 8.6 accepts a date such as 02/29/2023 (it normalizes it to 03/01/2023). Typing 3 as the last digit of the year in 02/29/2024 gives 02/29/2023; with Tcl 9 clock scan fails and the old year is kept. Tk 8.6 (Tcl 8.6), test datefield-3.21.

No existing tickets were found for these.

User Comments: serhiy.storchaka added on 2026-11-22 15:52:43:

Proposed fix for the + and - keys with Tk 9 in branch datefield-tk9-plus-minus.