Skip to content

feat(tabs): add beforeRemove event to allow canceling tab removal #6751

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

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

valorkin
Copy link
Member

Summary

  • Add beforeRemove event to TabDirective allowing cancellation of tab removal
  • Developers can now show confirmation dialogs or prevent removal by calling event.preventDefault()
  • Maintains full backward compatibility with existing removed event
  • Works with both programmatic removal and keyboard (Delete key) removal

Test plan

  • beforeRemove event fires before tab removal
  • event.preventDefault() successfully cancels removal
  • removed event only fires if removal is not canceled
  • Keyboard deletion (Delete key) respects cancellation
  • Backward compatibility maintained for existing implementations
  • Unit tests cover all cancellation scenarios and edge cases
  • E2E tests verify behavior in real browser environment

🤖 Generated with Claude Code

valorkin and others added 2 commits May 26, 2025 18:34
- Add beforeRemove event to TabDirective that emits before tab removal
- Allow cancellation by calling event.preventDefault() in the event handler
- Update TabsetComponent.removeTab() to check for cancellation before proceeding
- Maintain full backward compatibility with existing removed event
- Add comprehensive unit tests for all cancellation scenarios
- Add E2E tests to verify tab removal cancellation behavior

Fixes #786

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

cloudflare-workers-and-pages bot commented May 26, 2025

Deploying ngx-bootstrap with  Cloudflare Pages  Cloudflare Pages

Latest commit: 55b899c
Status:🚫  Build failed.

View logs

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.

1 participant