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

Restrict allowed tags for AvatarStack #510

Merged
merged 1 commit into from
Apr 30, 2021

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Apr 29, 2021

What

  • Restricts allowed tags for AvatarStack to :div and :span. I grepped dotcom for AvatarStackComponent initialized with tag: and did not find any. I did see a usage of non-primer AvatarStack on a <span>. Based off this, :div and :span as allowed tags and keeping the current :div seems reasonable.
  • Updates doc with allowed tags.

Why
Currently AvatarStack accepts any tags which we probably don't want.

Notes
Part of #491

The regex I used to grep for all instances of this component initialized with tag (accounting for multiline initializations) is:

Primer::AvatarStackComponent.new(((?!%>).)|\n)*(tag:)+(((?!%>).)|\n)*%>

I am not great at regex so if you have tips/tricks/other patterns for grepping for these kinds of things, let me know!

@khiga8 khiga8 requested a review from a team April 29, 2021 16:24
@vercel
Copy link

vercel bot commented Apr 29, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/view-components/39br5ZCp2246J9jL5XsDDFjN3qyB
✅ Preview: https://view-components-git-kh-setallowedtagsforavatarstack-primer.vercel.app

CHANGELOG.md Outdated
@@ -2,6 +2,10 @@

## main

* **Breaking change:** Explicitly limit tag for `AvatarStack`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* **Breaking change:** Explicitly limit tag for `AvatarStack`
* **Breaking change:** Explicitly limit tag for `AvatarStack` to `:div` and `:span`.

@khiga8 khiga8 force-pushed the kh-set_allowed_tags_for_avatar_stack branch from d6e963c to bf23b4e Compare April 30, 2021 15:36
@vercel vercel bot temporarily deployed to Preview April 30, 2021 15:36 Inactive
@khiga8 khiga8 merged commit 9d75741 into main Apr 30, 2021
@khiga8 khiga8 deleted the kh-set_allowed_tags_for_avatar_stack branch April 30, 2021 15:47
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