Skip to content
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

fix: Update utility functions for more usability #495

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

ethanWallace
Copy link
Collaborator

Summary | Résumé

Update the assignLanguage and inheritAttributes to be more usable and functional with GC Design System components going forward.

assignLanguage changes

Previously the assignLanguage would check if a lang attribute has been assigned to the host element of a component if needed. If not found, the function would then check the document element to get the page language for the component.

To better match how lang works in HTML, the component will now check it's ancestors all the way up to the document element for a lang attribute. This allows developers to tag sections of a page a different language from the default page language and have the component inherit the correct language.

inheritAttributes changes

inheritAttributes was built to take data attributes assigned to form components and pass them down to the input rendered in each form component and remove the attribute from the host element. With the introduction of form-associated components and shadow-dom, data attributes will no longer be passed down to the rendered input since the component is now recognized as a form input in HTML forms.

@ethanWallace ethanWallace requested review from daine and melaniebmn April 5, 2024 18:31
Copy link
Collaborator

@melaniebmn melaniebmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nice change for the language assignment!

Copy link
Collaborator

@daine daine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a neat function closestElement, LGTM!

@ethanWallace ethanWallace merged commit a0e8fbb into main Apr 9, 2024
3 checks passed
@ethanWallace ethanWallace deleted the fix/util-functions branch April 9, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants