Skip to content

fix(a11y): fix table header is empty and add localization support #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/PickerPanel/DatePanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ export default function DatePanel<DateType extends object = any>(props: DatePane
: []);

if (prefixColumn) {
headerCells.push(<th key="empty" aria-label="empty cell" />);
headerCells.push(
<th key="empty">
<span style={{ width: 0, height: 0, position: 'absolute', overflow: 'hidden', opacity: 0 }}>
{locale.week}
</span>
</th>,
);
}
for (let i = 0; i < WEEK_DAY_COUNT; i += 1) {
headerCells.push(<th key={i}>{weekDaysLocale[(i + weekFirstDay) % WEEK_DAY_COUNT]}</th>);
Expand Down Expand Up @@ -136,7 +142,7 @@ export default function DatePanel<DateType extends object = any>(props: DatePane
const yearNode: React.ReactNode = (
<button
type="button"
aria-label="year panel"
aria-label={locale.yearSelect}
key="year"
onClick={() => {
onModeChange('year', pickerValue);
Expand All @@ -154,7 +160,7 @@ export default function DatePanel<DateType extends object = any>(props: DatePane
const monthNode: React.ReactNode = (
<button
type="button"
aria-label="month panel"
aria-label={locale.monthSelect}
key="month"
onClick={() => {
onModeChange('month', pickerValue);
Expand Down
2 changes: 1 addition & 1 deletion src/PickerPanel/MonthPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function MonthPanel<DateType extends object = any>(
<button
type="button"
key="year"
aria-label="year panel"
aria-label={locale.yearSelect}
onClick={() => {
onModeChange('year');
}}
Expand Down
8 changes: 4 additions & 4 deletions src/PickerPanel/PanelHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function PanelHeader<DateType extends object>(props: HeaderProps<DateType>) {
{superOffset && (
<button
type="button"
aria-label="super-prev-year"
aria-label={locale.previousYear}
onClick={() => onSuperOffset(-1)}
tabIndex={-1}
className={classNames(
Expand All @@ -138,7 +138,7 @@ function PanelHeader<DateType extends object>(props: HeaderProps<DateType>) {
{offset && (
<button
type="button"
aria-label="prev-year"
aria-label={locale.previousMonth}
onClick={() => onOffset(-1)}
tabIndex={-1}
className={classNames(prevBtnCls, disabledOffsetPrev && `${prevBtnCls}-disabled`)}
Expand All @@ -152,7 +152,7 @@ function PanelHeader<DateType extends object>(props: HeaderProps<DateType>) {
{offset && (
<button
type="button"
aria-label="next-year"
aria-label={locale.nextMonth}
onClick={() => onOffset(1)}
tabIndex={-1}
className={classNames(nextBtnCls, disabledOffsetNext && `${nextBtnCls}-disabled`)}
Expand All @@ -165,7 +165,7 @@ function PanelHeader<DateType extends object>(props: HeaderProps<DateType>) {
{superOffset && (
<button
type="button"
aria-label="super-next-year"
aria-label={locale.nextYear}
onClick={() => onSuperOffset(1)}
tabIndex={-1}
className={classNames(
Expand Down
2 changes: 1 addition & 1 deletion src/PickerPanel/QuarterPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function QuarterPanel<DateType extends object = any>(
<button
type="button"
key="year"
aria-label="year panel"
aria-label={locale.yearSelect}
onClick={() => {
onModeChange('year');
}}
Expand Down
2 changes: 1 addition & 1 deletion src/PickerPanel/YearPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function YearPanel<DateType extends object = any>(
<button
type="button"
key="decade"
aria-label="decade panel"
aria-label={locale.decadeSelect}
onClick={() => {
onModeChange('decade');
}}
Expand Down
1 change: 1 addition & 0 deletions src/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type Locale = {
dateSelect: string;
weekSelect?: string;
clear: string;
week: string;
month: string;
year: string;
previousMonth: string;
Expand Down
1 change: 1 addition & 0 deletions src/locale/am_ET.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const locale: Locale = {
backToToday: 'ወደ ዛሬ ተመለስ',
ok: 'እሺ',
clear: 'አንፃ',
week: 'ሳምንት',
month: 'ወር',
year: 'ዓመት',
timeSelect: 'ሰዓት ምረጥ',
Expand Down
1 change: 1 addition & 0 deletions src/locale/ar_EG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'العودة إلى اليوم',
ok: 'تأكيد',
clear: 'مسح',
week: 'الأسبوع',
month: 'الشهر',
year: 'السنة',
timeSelect: 'اختيار الوقت',
Expand Down
1 change: 1 addition & 0 deletions src/locale/az_AZ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Bugünə qayıt',
ok: 'Təsdiq',
clear: 'Təmizlə',
week: 'Həftə',
month: 'Ay',
year: 'İl',
timeSelect: 'vaxtı seç',
Expand Down
1 change: 1 addition & 0 deletions src/locale/bg_BG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Към днес',
ok: 'Добре',
clear: 'Изчистване',
week: 'Седмица',
month: 'Месец',
year: 'Година',
timeSelect: 'Избор на час',
Expand Down
1 change: 1 addition & 0 deletions src/locale/bn_BD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'আজকে ফিরে চলুন',
ok: 'ওকে',
clear: 'পরিস্কার',
week: 'সপ্তাহ',
month: 'মাস',
year: 'বছর',
timeSelect: 'সময় নির্বাচন',
Expand Down
1 change: 1 addition & 0 deletions src/locale/by_BY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Дадзеная дата',
ok: 'OK',
clear: 'Ачысціць',
week: 'Тыдзень',
month: 'Месяц',
year: 'Год',
timeSelect: 'Выбраць час',
Expand Down
1 change: 1 addition & 0 deletions src/locale/ca_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Tornar a avui',
ok: 'Acceptar',
clear: 'Netejar',
week: 'Setmana',
month: 'Mes',
year: 'Any',
timeSelect: 'Seleccionar hora',
Expand Down
1 change: 1 addition & 0 deletions src/locale/cs_CZ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Zpět na dnešek',
ok: 'OK',
clear: 'Vymazat',
week: 'Týden',
month: 'Měsíc',
year: 'Rok',
timeSelect: 'Vybrat čas',
Expand Down
1 change: 1 addition & 0 deletions src/locale/da_DK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Gå til i dag',
ok: 'OK',
clear: 'Ryd',
week: 'Uge',
month: 'Måned',
year: 'År',
timeSelect: 'Vælg tidspunkt',
Expand Down
1 change: 1 addition & 0 deletions src/locale/de_DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Zurück zu Heute',
ok: 'OK',
clear: 'Zurücksetzen',
week: 'Woche',
month: 'Monat',
year: 'Jahr',
timeSelect: 'Zeit wählen',
Expand Down
1 change: 1 addition & 0 deletions src/locale/el_GR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Πίσω στη σημερινή μέρα',
ok: 'OK',
clear: 'Καθαρισμός',
week: 'Εβδομάδα',
month: 'Μήνας',
year: 'Έτος',
timeSelect: 'Επιλογή ώρας',
Expand Down
1 change: 1 addition & 0 deletions src/locale/en_GB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Back to today',
ok: 'OK',
clear: 'Clear',
week: 'Week',
month: 'Month',
year: 'Year',
timeSelect: 'Select time',
Expand Down
1 change: 1 addition & 0 deletions src/locale/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Back to today',
ok: 'OK',
clear: 'Clear',
week: 'Week',
month: 'Month',
year: 'Year',
timeSelect: 'select time',
Expand Down
1 change: 1 addition & 0 deletions src/locale/es_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Volver a hoy',
ok: 'Aceptar',
clear: 'Limpiar',
week: 'Semana',
month: 'Mes',
year: 'Año',
timeSelect: 'Seleccionar hora',
Expand Down
1 change: 1 addition & 0 deletions src/locale/es_MX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Volver a hoy',
ok: 'Aceptar',
clear: 'Limpiar',
week: 'Semana',
month: 'Mes',
year: 'Año',
timeSelect: 'elegir hora',
Expand Down
1 change: 1 addition & 0 deletions src/locale/et_EE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Tagasi tänase juurde',
ok: 'OK',
clear: 'Tühista',
week: 'Nädal',
month: 'Kuu',
year: 'Aasta',
timeSelect: 'Vali aeg',
Expand Down
1 change: 1 addition & 0 deletions src/locale/eu_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Gaur itzuli',
ok: 'OK',
clear: 'Garbitu',
week: 'Asteko',
month: 'Hilabete',
year: 'Urte',
timeSelect: 'Ordua aukeratu',
Expand Down
1 change: 1 addition & 0 deletions src/locale/fa_IR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'بازگشت به روز',
ok: 'باشه',
clear: 'پاک کردن',
week: 'هفته',
month: 'ماه',
year: 'سال',
timeSelect: 'انتخاب زمان',
Expand Down
1 change: 1 addition & 0 deletions src/locale/fi_FI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Tämä päivä',
ok: 'OK',
clear: 'Tyhjennä',
week: 'Viikko',
month: 'Kuukausi',
year: 'Vuosi',
timeSelect: 'Valise aika',
Expand Down
1 change: 1 addition & 0 deletions src/locale/fr_BE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: "Aujourd'hui",
ok: 'OK',
clear: 'Rétablir',
week: 'Semaine',
month: 'Mois',
year: 'Année',
timeSelect: "Sélectionner l'heure",
Expand Down
1 change: 1 addition & 0 deletions src/locale/fr_CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: "Aujourd'hui",
ok: 'OK',
clear: 'Rétablir',
week: 'Semaine',
month: 'Mois',
year: 'Année',
timeSelect: "Sélectionner l'heure",
Expand Down
1 change: 1 addition & 0 deletions src/locale/fr_FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: "Aujourd'hui",
ok: 'OK',
clear: 'Rétablir',
week: 'Semaine',
month: 'Mois',
year: 'Année',
timeSelect: "Sélectionner l'heure",
Expand Down
1 change: 1 addition & 0 deletions src/locale/ga_IE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Ar ais inniu',
ok: 'ceart go leor',
clear: 'soiléir',
week: 'seachtain',
month: 'mhí',
year: 'bhliain',
timeSelect: 'roghnaigh am',
Expand Down
1 change: 1 addition & 0 deletions src/locale/gl_ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Voltar a hoxe',
ok: 'Aceptar',
clear: 'Limpar',
week: 'Semana',
month: 'Mes',
year: 'Ano',
timeSelect: 'Seleccionar hora',
Expand Down
1 change: 1 addition & 0 deletions src/locale/he_IL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'חזור להיום',
ok: 'אישור',
clear: 'איפוס',
week: 'שבוע',
month: 'חודש',
year: 'שנה',
timeSelect: 'בחר שעה',
Expand Down
1 change: 1 addition & 0 deletions src/locale/hi_IN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'आज तक',
ok: 'ठीक',
clear: 'स्पष्ट',
week: 'सप्ताह',
month: 'महीना',
year: 'साल',
timeSelect: 'समय का चयन करें',
Expand Down
1 change: 1 addition & 0 deletions src/locale/hr_HR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Natrag na danas',
ok: 'OK',
clear: 'Očisti',
week: 'Sedmica',
month: 'Mjesec',
year: 'Godina',
timeSelect: 'odaberite vrijeme',
Expand Down
1 change: 1 addition & 0 deletions src/locale/hu_HU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Vissza a mai napra', // 'Back to today',
ok: 'OK',
clear: 'Törlés', // 'Clear',
week: 'Hét',
month: 'Hónap', // 'Month',
year: 'Év', // 'Year',
timeSelect: 'Időpont kiválasztása', // 'Select time',
Expand Down
1 change: 1 addition & 0 deletions src/locale/id_ID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Kembali ke hari ini',
ok: 'Baik',
clear: 'Bersih',
week: 'Minggu',
month: 'Bulan',
year: 'Tahun',
timeSelect: 'pilih waktu',
Expand Down
1 change: 1 addition & 0 deletions src/locale/is_IS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Til baka til dagsins í dag',
ok: 'Í lagi',
clear: 'Hreinsa',
week: 'Vika',
month: 'Mánuður',
year: 'Ár',
timeSelect: 'Velja tíma',
Expand Down
1 change: 1 addition & 0 deletions src/locale/it_IT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Torna ad oggi',
ok: 'OK',
clear: 'Cancella',
week: 'Settimana',
month: 'Mese',
year: 'Anno',
timeSelect: "Seleziona l'ora",
Expand Down
1 change: 1 addition & 0 deletions src/locale/ja_JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const locale: Locale = {
dateSelect: '日時を選択',
weekSelect: '週を選択',
clear: 'クリア',
week: '週',
month: '月',
year: '年',
previousMonth: '前月 (ページアップキー)',
Expand Down
1 change: 1 addition & 0 deletions src/locale/ka_GE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'მიმდინარე თარიღი',
ok: 'OK',
clear: 'გასუფთავება',
week: 'კვირა',
month: 'თვე',
year: 'წელი',
timeSelect: 'დროის არჩევა',
Expand Down
1 change: 1 addition & 0 deletions src/locale/kk_KZ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Ағымдағы күн',
ok: 'Таңдау',
clear: 'Таза',
week: 'Апта',
month: 'Ай',
year: 'Жыл',
timeSelect: 'Уақытты таңдау',
Expand Down
1 change: 1 addition & 0 deletions src/locale/km_KH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const locale: Locale = {
dateSelect: 'ជ្រើសរើសកាលបរិច្ឆេទ',
weekSelect: 'ជ្រើសរើសសប្តាហ៍',
clear: 'ច្បាស់',
week: 'សប្តាហ៍',
month: 'ខែ',
year: 'ឆ្នាំ',
previousMonth: 'ខែមុន (ឡើងទំព័រ)',
Expand Down
1 change: 1 addition & 0 deletions src/locale/kmr_IQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'Vegere îro',
ok: 'Temam',
clear: 'Paqij bike',
week: 'Sêbê',
month: 'Meh',
year: 'Sal',
timeSelect: 'Demê hilbijêre',
Expand Down
1 change: 1 addition & 0 deletions src/locale/kn_IN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const locale: Locale = {
backToToday: 'ಇಂದು ಹಿಂದಿರುಗಿ',
ok: 'ಸರಿ',
clear: 'ಸ್ಪಷ್ಟ',
week: 'ವಾರ',
month: 'ತಿಂಗಳು',
year: 'ವರ್ಷ',
timeSelect: 'ಸಮಯ ಆಯ್ಕೆಮಾಡಿ',
Expand Down
Loading