Skip to content

Feat/datepicker modal search toolbar#72

Merged
tony140407 merged 10 commits into
mainfrom
feat/datepicker-modal-search-toolbar
Apr 27, 2026
Merged

Feat/datepicker modal search toolbar#72
tony140407 merged 10 commits into
mainfrom
feat/datepicker-modal-search-toolbar

Conversation

@tony140407
Copy link
Copy Markdown
Contributor

主要改動

新增 Date Picker、Modal、Search Feedback、Toolbar 四個元件

新增元件

  • Date Picker — 日曆對話框搭配 combobox 模式,支援鍵盤導航與年度切換
  • Modal — 使用原生 搭配 autofocus 與 form method=dialog 關閉機制
  • Search Feedback — 以 提供搜尋結果即時回饋
  • Toolbar — Roving tabindex 鍵盤導航與 aria-pressed 狀態管理

其他調整

  • 按鈕暗色模式樣式修正
  • live-example shortcode 支援 source 參數與保留 HTML 註解
  • 元件成熟度標示與 Logo SVG 語意結構修正

包含日曆對話框、combobox 模式、鍵盤導航與年度切換按鈕。
實作 WAI-ARIA dialog 模式,以 autofocus 管理焦點,關閉按鈕採用 form method=dialog。
以 output 元素提供搜尋結果即時回饋。
實作 roving tabindex 鍵盤導航與 aria-pressed 狀態管理。
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a suite of new accessible UI components, including a Date Picker, Modal, Search Feedback, and Toolbar, complete with styles, scripts, and documentation. The review feedback highlights several improvement opportunities for the Date Picker, such as disabling browser autocomplete, properly handling empty input states, and reverting invalid manual entries to ensure consistency between the enhanced and native inputs. Additionally, the Toolbar's menu navigation should be adjusted to follow W3C APG patterns, allowing arrow keys to return focus to the toolbar for a better user experience.

Comment thread static/js/components/date-picker.js
Comment thread static/js/components/date-picker.js Outdated
Comment on lines +706 to +708
if (!isValidDate(value)) {
this._updateFeedback('日期格式不正確,請輸入 YYYY-MM-DD 格式。');
return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

當手動輸入的日期格式不正確時,目前的實作僅播報錯誤但保留了無效的文字,這會導致增強輸入框與隱藏的 nativeInput 資料不一致。建議在驗證失敗時將輸入框還原為上一次有效的日期值。

Suggested change
if (!isValidDate(value)) {
this._updateFeedback('日期格式不正確,請輸入 YYYY-MM-DD 格式。');
return;
if (!isValidDate(value)) {
this._updateFeedback('日期格式不正確,請輸入 YYYY-MM-DD 格式。');
this._textInput.value = this.state.selectedDate || '';
return;
}

Comment thread static/js/components/toolbar.js Outdated
@tony140407 tony140407 force-pushed the feat/datepicker-modal-search-toolbar branch from 9f18337 to 6811f2f Compare April 24, 2026 02:10
Comment thread static/js/components/date-picker.js Outdated
textInput.className = 'dp__input dp__input--enhanced';
textInput.setAttribute('placeholder', 'YYYY-MM-DD');
textInput.setAttribute('role', 'combobox');
textInput.setAttribute('aria-haspopup', 'grid');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-haspopup="dialog" 確保與 popup 角色一致,避免產生預期互動方式與實際落差或使用者不知道如何操作。

由 JS 動態建立並插入,初始不存在於 HTML
JS 會加上以下屬性:
role="combobox"
aria-haspopup="grid"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

配合 js 註解之建議 修正 popup role 為 dialog

@tony140407 tony140407 merged commit 3aacd1e into main Apr 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants