Open jamigibbs opened 1 year ago
I don't think we should be determining this automatically. We should just provide the ability to set the alignment to left or right (we don't want centered).
Related issue created to add numerical alignment to the USWDS variation: https://github.com/department-of-veterans-affairs/vets-design-system-documentation/issues/2846
Description
During the PR review of the React Table component migration, it was noted that a column that was previously left aligned is now right aligned by the va-table web component.
Our utility function that determines if a column should be right aligned is:
As Jerek pointed out, it's being identified as numeric because
parseFloat('534-K90HEWN')
evaluates to 534.The design system documentation for table just says that "Numerical data is right-aligned" but we weren't exactly sure what is meant by "numerical" and if there's situations (like with the table above) where it wouldn't be right aligned.
Another possible issue is that the component is only checking the first instance of column data and it assumes the other column values are the same type. For example, if a columns data set is
123, 45b3, hello world
, these would all be right aligned because the first one evaluates to a number.Some questions to answer
Tasks
Acceptance Criteria