Calendar control - ReadOnly attribute issue in IE
I'm submitting a ... (check one with "x")
[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior I set the readonly attribute on the Calendar control to force the users to pick from the displayed dates from the panel. This works fine on Chrome and Firefox BUT on IE (IE 11), though it doent let me input the date using keyboard, it is still displaying the cursor. If I hit on the backspace button, the tab is getting closed and a new tab is being opened
Expected behavior This shouldn't display the cursor on IE as well.
Minimal reproduction of the problem with instructions add a calendar control to the HTML and set the read only attribute. test this behavior on IE. A cursor will be displayed and if you hit backspace when the cursor is active, the tab will be closed. that is the behavior i am observing,
What is the motivation / use case for changing the behavior? Calendar control should work across all the supported browsers.
Please tell us about your environment:
- Angular version: 2.2.3
- PrimeNG version: 2.0.X
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] Internet Explorer 11
-
Language: [all | TypeScript X.X | ES6/7 | ES5]
-
Node (for AoT issues):
node --version=
Seems like an IE problem, we'll see if we can do something.
A quick-fix while this is not fixed in the library. I wrapped the calendar with my own component and added this code to the component initialization.
ngOnInit() {
// prevent navigating to previous page in IE11 when backspace is pressed
$(this.element.nativeElement).find('p-calendar').keydown(event => {
let isBackspace = event.keyCode === 8;
if (isBackspace) {
event.preventDefault();
}
});
}
The jQuery part can be easily replaced by native code if it is not used in your project.
Hi,
So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!
Best Regards,