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 for Issue #6109 - aria-current has incorrect value "true" #6118

Merged
merged 2 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react-router-dom/modules/NavLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ NavLink.propTypes = {

NavLink.defaultProps = {
activeClassName: "active",
"aria-current": "true"
"aria-current": "page"
};

export default NavLink;
8 changes: 4 additions & 4 deletions packages/react-router-dom/modules/__tests__/NavLink-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("NavLink", () => {
expect(a.style.color).toBe(activeStyle.color);
});

it("applies aria-current of true if no override value is given", () => {
it("applies aria-current of page if no override value is given", () => {
ReactDOM.render(
<MemoryRouter initialEntries={["/pizza"]}>
<NavLink to="/pizza" activeClassName="selected">
Expand All @@ -63,20 +63,20 @@ describe("NavLink", () => {
node
);
const a = node.getElementsByTagName("a")[0];
expect(a.getAttribute("aria-current")).toEqual("true");
expect(a.getAttribute("aria-current")).toEqual("page");
});

it("applies the override aria-current value when given", () => {
ReactDOM.render(
<MemoryRouter initialEntries={["/pizza"]}>
<NavLink to="/pizza" activeClassName="selected" aria-current="page">
<NavLink to="/pizza" activeClassName="selected" aria-current="true">
Pizza!
</NavLink>
</MemoryRouter>,
node
);
const a = node.getElementsByTagName("a")[0];
expect(a.getAttribute("aria-current")).toEqual("page");
expect(a.getAttribute("aria-current")).toEqual("true");
});

it("handles locations without a pathname", () => {
Expand Down