Skip to content

Conversation

@rebeccaalpert
Copy link
Member

@rebeccaalpert rebeccaalpert commented Dec 2, 2024

SkipToContent does not work in the context of the PatternFly page. Using document.getElementById sidesteps this issue and allows them to work as usual. I tried using refs, but because Page is an older class component, the refs were not compatible. We'd likely need to rewrite page as a function component. I'm not able to accomplish this in the short time before the end of the year. This is good enough for now, in my opinion.

SkipToContentBasic works as advertised, so I am not touching that, and I also did not touch react-integration or unit tests.

What: Closes #7554

SkipToContent does not work in the context of the PatternFly page. Using document.getElementById sidesteps this issue and allows them to work as usual. I tried using refs, but because Page is an older class component, the refs were not compatible. We'd likely need to rewrite page as a function component. This is good enough for now, in my opinion. SkipToContentBasic works as advertised, so I am not touching that, and I also did not touch react-integration or unit tests.
@patternfly-build
Copy link
Collaborator

patternfly-build commented Dec 2, 2024

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Can we update the SkipToContent example as well?

@tlabaj tlabaj requested review from a team, kmcfaul and tlabaj and removed request for a team, kmcfaul and tlabaj December 3, 2024 20:46
Use refs in demo to match other demos.
@rebeccaalpert
Copy link
Member Author

rebeccaalpert commented Dec 3, 2024

Pushed an update to the skip to content so it uses an onClick. I wrapped the content in a Content component so it's styled appropriately. After consultation with Eric, also wrapped the content in a div so it would tab appropriately to the next link after you skip to content.

@thatblindgeye thatblindgeye merged commit 6411961 into patternfly:main Dec 4, 2024
13 checks passed
mattnolting pushed a commit to mattnolting/patternfly-react that referenced this pull request Feb 14, 2025
* chore(docs): Add onClick to SkipToContent in demos

SkipToContent does not work in the context of the PatternFly page. Using document.getElementById sidesteps this issue and allows them to work as usual. I tried using refs, but because Page is an older class component, the refs were not compatible. We'd likely need to rewrite page as a function component. This is good enough for now, in my opinion. SkipToContentBasic works as advertised, so I am not touching that, and I also did not touch react-integration or unit tests.

* chore(SkipToContent): Update demo

Use refs in demo to match other demos.
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.

Bug - Skip to content - focus remains at top of page in demos

4 participants