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

Add live region for navigation changes #2214

Merged
merged 7 commits into from
Jun 4, 2024

Conversation

RoyEJohnson
Copy link
Contributor

@RoyEJohnson RoyEJohnson commented Apr 5, 2024

DISCO-187

Adding you as a reviewer, Tom, because I suspect there are decisions I made that are open to criticism.

@RoyEJohnson RoyEJohnson requested a review from a team as a code owner April 5, 2024 18:20
@RoyEJohnson RoyEJohnson requested a review from Dantemss April 5, 2024 18:20
@TomWoodward TomWoodward temporarily deployed to rex-web-add-live-region-mdsxf1 April 5, 2024 18:21 Inactive
@RoyEJohnson RoyEJohnson requested a review from TomWoodward April 5, 2024 18:28
@TomWoodward TomWoodward temporarily deployed to rex-web-add-live-region-mdsxf1 April 9, 2024 19:42 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-add-live-region-mdsxf1 April 9, 2024 20:01 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-add-live-region-mdsxf1 April 10, 2024 13:59 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-add-live-region-mdsxf1 April 10, 2024 19:16 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-add-live-region-mdsxf1 April 11, 2024 14:12 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-add-live-region-mdsxf1 April 11, 2024 19:27 Inactive
@RoyEJohnson RoyEJohnson requested a review from Dantemss April 16, 2024 20:53
Copy link
Member

@Dantemss Dantemss left a comment

Choose a reason for hiding this comment

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

Well not sure about setting the fn property on the exported function, but I guess it's fine?

@RoyEJohnson RoyEJohnson force-pushed the add-live-region-for-navigation-changes branch from 33b0307 to bf1cf4f Compare May 1, 2024 15:58
@@ -134,6 +134,7 @@ const NavigationBar = ({user, loggedOut, currentPath}: NavigationBarProps) =>
</a>
{loggedOut && <LoggedOutState currentPath={currentPath} />}
{user && <LoggedInState user={user} currentPath={currentPath} />}
<Styled.PageTitleConfirmation />
Copy link
Member

Choose a reason for hiding this comment

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

does it matter where in the document you put this? it doesn't read it in order or anything right? maybe put it up the tree a bit in Layout or Content or something? NavBar seems a bit weird

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to Layout

className="c13"
id="page-title-confirmation"
>
Loaded page ""
Copy link
Member

Choose a reason for hiding this comment

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

does this read out on page load? would we prefer that it be empty at first instead of having "loaded page [silence]"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have it skip the first non-blank value

PageTitleConfirmation
} from './PageTitleConfirmation';

describe('On scroll', () => {
Copy link
Member

Choose a reason for hiding this comment

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

on scroll?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😳

fn?: (title: string) => void;
};

const announcePageTitle: FunctionWithProperty = (title: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

i think this component should work based on being connected to the redux state instead of having a separate callback like this

@RoyEJohnson RoyEJohnson force-pushed the add-live-region-for-navigation-changes branch from d88c138 to 45c85ab Compare May 13, 2024 16:22
Skip announcing initial page title
@RoyEJohnson RoyEJohnson requested a review from TomWoodward May 13, 2024 19:47
Copy link
Member

@TomWoodward TomWoodward left a comment

Choose a reason for hiding this comment

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

this is looking fine to me, please confirm that those tests aren't complaining about the act call and i will approve.

);
}

export default connect(({ head: { title } }: AppState) => ({ title }))(styled(
Copy link
Member

Choose a reason for hiding this comment

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

there is a selector for the title https://github.com/openstax/rex-web/blob/main/src/app/head/selectors.ts#L19

using it will affect nobody's life but it follows the convention. when you have derived values in selectors it does make a difference because they're memoized based on the input state and will help reduce react re-renders

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a auto-focus to main when its content changes, and also revised this to use the selector.

@RoyEJohnson RoyEJohnson requested a review from TomWoodward May 14, 2024 17:56
@TomWoodward
Copy link
Member

@RoyEJohnson can you remove the focus on main thing and we'll get the announcement merged? i have concerns about when the content is changed as part of a navigation with a target, like clicking a search result or a link with a hash

@RoyEJohnson RoyEJohnson force-pushed the add-live-region-for-navigation-changes branch from 1a9a8b1 to 15f6828 Compare May 14, 2024 18:13
@RoyEJohnson
Copy link
Contributor Author

RoyEJohnson commented May 14, 2024

There is an existing issue for focusing on main when content changes.

@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-add-live-region-vrqbw5 June 4, 2024 11:51 Inactive
@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-add-live-region-vrqbw5 June 4, 2024 12:38 Inactive
@Malar-Natarajan Malar-Natarajan merged commit 6590014 into main Jun 4, 2024
7 of 9 checks passed
@Malar-Natarajan Malar-Natarajan deleted the add-live-region-for-navigation-changes branch June 4, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants