@indico-data/design-system 3.6.4 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "3.6.4",
3
+ "version": "3.7.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -4,6 +4,7 @@ import { DatePickerProps } from './types';
4
4
  import { getCommonProps } from './contants';
5
5
  import { TimePicker } from '../../timePicker/TimePicker';
6
6
  import { Col, Row } from '../../../grid';
7
+ import { useEffect, useRef } from 'react';
7
8
 
8
9
  export const DatePicker = (props: DatePickerProps) => {
9
10
  const {
@@ -84,9 +85,33 @@ export const DatePicker = (props: DatePickerProps) => {
84
85
  };
85
86
 
86
87
  const finalProps = { ...commonProps, ...rest, ...modeProps };
88
+ const wrapperRef = useRef<HTMLDivElement>(null);
89
+
90
+ // Disable tab focus on all date picker elements
91
+ useEffect(() => {
92
+ const disableTabFocus = () => {
93
+ if (wrapperRef.current) {
94
+ const focusableElements = wrapperRef.current.querySelectorAll(
95
+ 'button, input, select, textarea, a, [tabindex]:not([tabindex="-1"])',
96
+ );
97
+ focusableElements.forEach((element) => {
98
+ (element as HTMLElement).tabIndex = -1;
99
+ });
100
+ }
101
+ };
102
+
103
+ // Run immediately and set up observer for dynamic elements
104
+ disableTabFocus();
105
+ const observer = new MutationObserver(disableTabFocus);
106
+ if (wrapperRef.current) {
107
+ observer.observe(wrapperRef.current, { childList: true, subtree: true });
108
+ }
109
+
110
+ return () => observer.disconnect();
111
+ }, []);
87
112
 
88
113
  return (
89
- <div className="date-picker-wrapper">
114
+ <div className="date-picker-wrapper" tabIndex={-1} ref={wrapperRef}>
90
115
  {hasTimePicker && (
91
116
  <div className="time-picker-wrapper">
92
117
  <Row align="center">