Skip to content

Conversation

@VibhorJaiswal
Copy link
Contributor

@VibhorJaiswal VibhorJaiswal commented Nov 12, 2024

fixes: #6843

Hi! as discussed in PR #6852 to prevent the action on all anchors within code examples within the playground component, here is the revised solution.

@VibhorJaiswal VibhorJaiswal changed the title fix: preventing redirects from live editor fix: preventing redirects from live preview Nov 12, 2024
@VibhorJaiswal VibhorJaiswal marked this pull request as ready for review November 12, 2024 20:00

const handleCustomRedirect = (e) => {
const target = e.target as HTMLElement;
if (target.closest('a[href]')) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you try this?

if (e.target.tagName === 'A') {
  e.preventDefault();
}

);


const handleCustomRedirect = (e) => {
Copy link
Member

Choose a reason for hiding this comment

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

Can you wrap this callback with a useEventCallback from @restart/hooks. Also add a type to e and remove the cast on line 60

@VibhorJaiswal VibhorJaiswal marked this pull request as draft November 14, 2024 18:20
@VibhorJaiswal VibhorJaiswal marked this pull request as ready for review November 15, 2024 14:32
@VibhorJaiswal
Copy link
Contributor Author

Hi! @kyletsang, I've implemented the changes based on your suggestions. Could you please review and let me know if it looks good now?

@kyletsang kyletsang merged commit dc802d9 into react-bootstrap:master Nov 18, 2024
12 checks passed
@kyletsang
Copy link
Member

Thanks

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.

Docs - Components/Navs and tabs

2 participants