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 use early return to VisuallyHidden #6293

Closed

Conversation

Collection50
Copy link

Before

image

After

image

What I did

  1. Early-return was used to improve the readability of the if/else syntax.
  2. The stability was improved by eliminating the possibility of reallocation of the let using const.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@snowystinger
Copy link
Member

Thanks for the PR, however, we don't typically use const because it gives a false sense of security and can introduce unnecessary churn in PRs. For example, const !== immutable.
In addition, I don't notice a strong difference in readability and it seems unnecessary to introduce a change to working code without a compelling reason.

Feel free to open an Issue or Discussion for further comments.

Thank you!

@Collection50
Copy link
Author

Thanks for the PR, however, we don't typically use const because it gives a false sense of security and can introduce unnecessary churn in PRs. For example, const !== immutable. In addition, I don't notice a strong difference in readability and it seems unnecessary to introduce a change to working code without a compelling reason.

Feel free to open an Issue or Discussion for further comments.

Thank you!

Thank you for your kind answer.

I changed the code to use the Early return syntax to improve the slight readability.

But I think you know better about this project because you are a more active country viewer of this project.

I will gladly accept your opinion.
Thank you for making a good contribution to the development ecosystem with a great library like react-spectrum. ❤️

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.

2 participants