EightfoldAI / octuple

The Octuple component library
MIT License
17 stars 51 forks source link

Add default aria label for close button in Modal component #843

Open samyakj-eightfold opened 4 months ago

samyakj-eightfold commented 4 months ago

Many modal instances use either "Close modal" or "Close panel" as the closeButtonAriaLabelText prop for Modal component. Since the developer is usually expected to specify the onClose functionality and not different props for close button, we can also provide the aria label by default (similar to the icon props for close button). Furthermore, it would bring consistency in aria label across different modals.

Screenshot 2024-05-30 at 1 12 49 AM

PR for the fix

dkilgore-eightfold commented 4 months ago

The closeButtonAriaLabelText prop is available. Providing a default prop is only effective if the Locale is properly passed to the ConfigProvider as documented in Storybook. Given this is not the case in all but 5 of Eightfold's applications, I suggest using your own localized string

dkilgore-eightfold commented 4 months ago

Re-opened as I found the default string is not being defined in Modal, only in Dialog. Both use BaseDialog as root.