-
Notifications
You must be signed in to change notification settings - Fork 371
Description
My thought would be to only make the logo an
a
tag if there's anhref
. In this context an<a>
tag without anhref
doesn't make much sense.
Referencing the PageHeader component - since logoComponent
is an a
by default, it needs some sort of link attribute for that to be the appropriate element to use there. I wonder if there is a good way to detect whether the element is suitable as an <a>
or some other element? As in if it has an href
or sets a location on click, it's rendered as an <a>
? If it just has a click handler, maybe it should be a <button>
instead, or role="button"
, since an <a>
without a href
has no implicit role. Otherwise it's rendered as a <span>
?
I see you can pass a logoComponent
to achieve these variations, but was curious if there is a way we could do this detection for the user and default to a <span>
UPDATE: The PageHeader and it's logoComponent
prop are deprecated in v5. But we would want to make this same change to the MastheadBrand component, so that it's only an anchor when an href is provided, otherwise it'd default to a div (and can be overriden by MastheadBrand's component
prop)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status