Skip to content

Commit 8b7fb3e

Browse files
ryo-manbayihuiliao
andauthored
Add hrefLang attribute to Link (#5894)
Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com>
1 parent aa83c12 commit 8b7fb3e

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

packages/@react-aria/utils/src/filterDOMProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const labelablePropNames = new Set([
2626
// See LinkDOMProps in dom.d.ts.
2727
const linkPropNames = new Set([
2828
'href',
29+
'hrefLang',
2930
'target',
3031
'rel',
3132
'download',

packages/@react-types/shared/src/dom.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ export interface TextInputDOMProps extends DOMProps, InputDOMProps, TextInputDOM
173173
export interface LinkDOMProps {
174174
/** A URL to link to. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href). */
175175
href?: string,
176+
/** Hints at the human language of the linked URL. See[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang). */
177+
hrefLang?: string,
176178
/** The target window for the link. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target). */
177179
target?: HTMLAttributeAnchorTarget,
178180
/** The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel). */

packages/react-aria-components/stories/Link.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919

2020
export const LinkExample = () => {
2121
return (
22-
<Link data-testid="link-example"href="https://www.imdb.com/title/tt6348138/" target="_blank">
22+
<Link data-testid="link-example" href="https://www.imdb.com/title/tt6348138/" hrefLang="en" target="_blank">
2323
The missing link
2424
</Link>
2525
);

0 commit comments

Comments
 (0)