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

No space possible for <input> element in tab heading #5559

Closed
stefanmeschke opened this issue Nov 27, 2019 · 2 comments
Closed

No space possible for <input> element in tab heading #5559

stefanmeschke opened this issue Nov 27, 2019 · 2 comments

Comments

@stefanmeschke
Copy link

stefanmeschke commented Nov 27, 2019

Bug description

For a custom tab heading with an input element. It is not possible to insert a space in this input.
It seems that the space is not possible because of this code block:

if (event.keyCode === 13 || event.key === 'Enter' || event.keyCode === 32 || event.key === 'Space') {
event.preventDefault();
const currentTab = list[(index) % list.length];
currentTab.click();
return;
}

Plunker/StackBlitz that reproduces the issue

https://stackblitz.com/edit/angular-kkt91e

Versions

ngx-bootstrap: 5.2.0
Angular: 8.2.13

Expected behavior

Input with space should be possible or it would be very nice to disable the whole key navigation.

@stefanmeschke
Copy link
Author

I fixed it with:

Template
<input (keydown)=keydown($event) … />

Component

import { includes } from 'lodash';

…

public keydown(event: KeyboardEvent) {
  if (includes(['Space', 'ArrowLeft', 'ArrowRight'], event.code)) {
    event.stopPropagation();
  }
}

But I think an option to disable the keyboard events would be very very nice. ;)

Cheers
SM

@fhuschle
Copy link
Contributor

I started reviewing/reproducing this issue. I think it can be closed as it can be fixed with the TabsetConfig.isKeysAllowed property or did i miss something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants