openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

'isDefaultPrevented is not a function' when trying to prevent selection from TabContainer overflow list

Open antonborisoff opened this issue 2 years ago • 5 comments

OpenUI5 version:

1.103

Browser/version (+device/version):

Chrome Version 103.0.5060.53

Any other tested browsers/devices(OK/FAIL):

No

URL (minimal example if possible):

https://jsfiddle.net/a8q5hdc7/

User/password (if required and possible - do not post any confidential information here):

Steps to reproduce the problem:

  1. Open Tab Container Overflow List
  2. Select an item from this list (e.g. 'key 8')

What is the expected result?

Tab is not switched, no errors in console

What happens instead?

Uncaught TypeError: E.isDefaultPrevented is not a function at k._activateItem (TabStrip-dbg.js:760:32) at constructor. (TabStrip-dbg.js:668:8) at b.fireEvent (EventProvider-dbg.js:247:11) at d.fireEvent (Element-dbg.js:626:23) at y.fireChange (Select-dbg.js:2490:11) at y.onSelectionChange (Select-dbg.js:1571:4) at b.fireEvent (EventProvider-dbg.js:247:11) at d.fireEvent (Element-dbg.js:626:23) at f.fireSelectionChange (ManagedObjectMetadata-dbg.js:799:44) at d._activateItem (SelectList-dbg.js:318:6)

Any other information? (attach screenshot if possible)

image

Please, provide a fix for SAPUI5 as well and downport it to version 1.71.36

antonborisoff avatar Jul 07 '22 07:07 antonborisoff

I'm not able to reproduce the error. Could you please check again if the steps are still valid in Incognito or Guest mode of the browser?

boghyon avatar Jul 07 '22 10:07 boghyon

hi @boghyon . Just did it in Incognito, the error is there.

antonborisoff avatar Jul 07 '22 10:07 antonborisoff

Are you sure you select an item from Overflow List?

antonborisoff avatar Jul 07 '22 10:07 antonborisoff

I can reproduce it. It seems to be an issue in the TabStrip.js code itself. The _activateItem method expects a jQuery.Event object (which has a isDefaultPrevented method), but the code in _createSelect calls this method with a UI5 control event object, which does not have such a method.

The code exists already for quite some time, but the issue only occurs when a listener to the TabStrip's itemSelect event vetoes (update: I meant: calls preventDefault on) that event. Maybe that's the reason why this went unnoticed until now.

codeworrior avatar Jul 07 '22 11:07 codeworrior

Hello @antonborisoff ,

Thank you for sharing this finding. I've created an internal incident 2280136862. The status of the issue will be updated here in GitHub.

Regards, Johannes

H4ze avatar Jul 18 '22 08:07 H4ze

Hi @H4ze .

Do you have any updates regarding the issue?

antonborisoff avatar Aug 18 '22 06:08 antonborisoff

Hello @antonborisoff,

The issue is fixed for the master branch and the fix will be available since sapui5 version 1.107.0.

Best Regards, Boyan Rakilovski

unazko avatar Sep 12 '22 15:09 unazko

Fixed by https://github.com/SAP/openui5/commit/8e8893588f83aabc392e901b5a2d9bbfd5454efa

boghyon avatar Sep 12 '22 15:09 boghyon

Hi @boghyon Could you, please, downport it to SAPUI 1.71.47?

antonborisoff avatar Sep 13 '22 08:09 antonborisoff

Hi @antonborisoff, I just documented the commit here but am not the owner of it. @unazko: Is it possible to downport the fix?

boghyon avatar Sep 13 '22 09:09 boghyon