@@ -27,9 +27,9 @@ export interface DataViewThResizableProps {
2727 increment ?: number ;
2828 /** Increment for keyboard navigation while shift is held */
2929 shiftIncrement ?: number ;
30- /** Aria label for the resize button */
30+ /** Provides an accessible name for the resizable column via a human readable string. */
3131 resizeButtonAriaLabel ?: string ;
32- /** Screenreader text for the column */
32+ /** Screenreader text that gets announced when the column is resized. */
3333 screenReaderText ?: string ;
3434}
3535export interface DataViewThProps {
@@ -40,15 +40,15 @@ export interface DataViewThProps {
4040 /** @hide Indicates whether the table has resizable columns */
4141 hasResizableColumns ?: boolean ;
4242 /** Props passed to Th */
43- props ?: ThProps ;
43+ thProps ?: ThProps ;
4444}
4545
4646export const DataViewTh : FC < DataViewThProps > = ( {
4747 content,
4848 resizableProps = { } ,
4949 hasResizableColumns = false ,
50- props : thProps ,
51- ...restProps
50+ thProps,
51+ ...props
5252} : DataViewThProps ) => {
5353 const thRef = useRef < HTMLTableCellElement > ( null ) ;
5454
@@ -57,7 +57,7 @@ export const DataViewTh: FC<DataViewThProps> = ({
5757 const isResizable = resizableProps ?. isResizable || false ;
5858 const increment = resizableProps ?. increment || 5 ;
5959 const shiftIncrement = resizableProps ?. shiftIncrement || 25 ;
60- const resizeButtonAriaLabel = resizableProps ?. resizeButtonAriaLabel || `Resize ${ content } ` ;
60+ const resizeButtonAriaLabel = resizableProps ?. resizeButtonAriaLabel ;
6161 const onResize = resizableProps ?. onResize || undefined ;
6262 const screenReaderText = resizableProps ?. screenReaderText || `Column ${ width . toFixed ( 0 ) } pixels` ;
6363
@@ -67,6 +67,11 @@ export const DataViewTh: FC<DataViewThProps> = ({
6767 const isResizing = useRef ( false ) ;
6868 const isInView = useRef ( true ) ;
6969
70+ if ( isResizable && ! resizeButtonAriaLabel ) {
71+ // eslint-disable-next-line no-console
72+ console . warn ( 'DataViewTh: Missing resizeButtonAriaLabel. An aria label must be passed to each resizable column to provide a context specific label for its resize button.' ) ;
73+ }
74+
7075 useEffect ( ( ) => {
7176 if ( ! isResizable ) {
7277 return ;
@@ -255,7 +260,7 @@ export const DataViewTh: FC<DataViewThProps> = ({
255260 } ;
256261
257262 return (
258- < Th { ...thProps } { ...restProps } style = { width > 0 ? { minWidth : width } : undefined } ref = { thRef } >
263+ < Th { ...thProps } { ...props } style = { width > 0 ? { minWidth : width } : undefined } ref = { thRef } >
259264 { content }
260265 { isResizable && (
261266 < Button
0 commit comments