-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Filter lose focus while typing #1475
Comments
Well I see that as a normal behavior since you clicked on the button in the grid to open the modal, by doing so, you changed the focus to the cell so yes the filter focus is lost. |
Sorry maybe i didn't describe it well. I meant the problem is after closing the modal. Clicking on filter input. After the first char the filter loses focus. The gif was a bit too long and dispersive, sorry. |
I can't help without a full repro, please use the Stackblitz link provided on the main readme page and modify any of the example to include this problem. |
Sorry for the late response, i'm hardly trying to repro the error but is harder than i thought. It seems some sort of strange interaction between slickgrid and ngx-bootstrap modals. Which is one of the following two: Deleting those elements filters focus works as expected after dataview changes. EDIT: Adding this piece of code works but it's a terrible workaround. modalRef.onHide.subscribe(() => {
document.getElementById('OffertaFormazionePersoneGridDTO').querySelectorAll('[tabindex="0"]').forEach((el) => {
if (!(el.classList.length > 0)) {
const copy = el.cloneNode(true);
const parent = el.parentNode;
el.remove();
setTimeout(() => {
parent.appendChild(copy);
});
}
});
}); |
This seems to be more of an upstream dependency problem unrelated to my project and with this new info, if you search on the ngx-bootstrap project you will find similar issues like these ones Longer closing time of modals in 18.0.2 affecting Cypress tests and if you look at some of their implementation on this line of code, you see that they have a So it really looks like this is unrelated to my project and ngx-boostrap is playing with the set focus and after taking a look at the default filter input in Slickgrid-Universal, I don't have any set focus. So again, it all seems to point at ngx-bootstrap being the culprit and stealing the focus, which I certainly don't support, neither want to troubleshoot external libraries. As per the first issue above, maybe give a try to fix your version of ngx-bootstrap at v18.0.0 (not v18.0.2 because of the issue) and/or maybe try to disable the animation and see if that helps... in summary, I more inclined to close this issue since it all seems to point at the upstream (external) dependency |
I'm pretty sure too that one of the main actors of this problem is ngx-bootstrap but there's some things i'm struggling with. Filters get blurred not after time (waiting 1 to 10 seconds before typing is not different). But exactly when search result is diffrent from initial result. For example: In 10 rows, all containing the char 'R' filter is not losing focus. Also the DOM activeElement is inside anglar-slickgrid DOM element (as mentioned above). And deleting and reinserting it resolve the problem. Not assuming the problem is Angular-slickgrid (i'm a big fan of this datagrid). Now i'll try with a different version. I'm using Angular 17 so ngx-bootstrap version is 12 (compatibility table) |
Well the thing is that you still haven't provided a full repro and if you can't provide a repro then you are unfortunately on your own to debug it. If I take a look at the Slickgrid-Universal Going back to the 3 events I mentioned above, adding a breakpoint into that event listener is a bit tricky. You can add a conditional breakpoint as shown in animated gif below and then look at the call stack to find out who or what triggered the blur and if you're lucky it might help. The other bad thing is that Angular Zone.js wraps all events into a ton of wrappers and it's hard to find the actual listener which is why I went directly to the I seriously can't help without a full repro which you did not provide, so unless there's a repro, I will eventually close this issue. This project is provided for (Open Source) but I certainly don't want to lose a ton of time troubleshooting something without a repro (especially when it looks to be caused by something external to the project). You can also see this SO to guide on how to add a conditional breakpoint |
This issue has been automatically closed because there has been no response to our request for code to reproduce the original error by the original author. With only the information that is currently in the issue, we don't have the means to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
@Silimim I'm pretty sure that I've fixed this problem in latest release via this Slickgrid-Universal PR fix: input filter loses focus after edit+filtering with So the latest release v8.10.2 includes the fix for this issue (assuming this is the same issue which is likely) |
Oh well that's amazing. This may explain me why the repro was not having the same behaviour. I was not event thinking that |
Describe the bug
We've found out a problem with filters input and modals, after a modal is opened and closed filters lose their focus after keydown.
Observations:
It seems to happens when dataview changes after filtering, if rows do not change, input don't lose focus.
What i've tried:
Most close solution:
The only workarout i've found is setting
filterTypingDebounce: 750
this allows to write more chars, but after debounce end input still lose focusReproduction
Steps:
Expectation
No response
Environment Info
Validations
The text was updated successfully, but these errors were encountered: