box / box-content-preview

JavaScript library for rendering files stored on Box
https://developer.box.com/docs/box-content-preview
Other
106 stars 113 forks source link

fix(annotations): Fix annotation region in mobile #1521

Closed marcoartaviaq closed 4 months ago

marcoartaviaq commented 4 months ago

Fix the creation of annotation regions when enableAnnotationsDiscoverability is set to false. When enableAnnotationsDiscoverability is true, the class bp-annotations-discoverable is added. This class sets pointer-events: none on the.textLayerelement (see source) to prevent the text layer from intercepting pointer events intended for the region creator. This PR introduces pointer-events: none to the .textLayerelement when the region creation button is enabled (this causes the class bp-annotations-create--region to be added), allowing users to comment by region even when discoverability is disabled.

Behavior before the update:

https://github.com/box/box-content-preview/assets/2131354/928e21ab-845d-411e-89d4-1f960cbe83f5

Behavior after the update:

https://github.com/box/box-content-preview/assets/2131354/24515117-8412-4d06-8cda-37eb7f447275

Behavior in other non mobile browsers:

Firefox:

https://github.com/box/box-content-preview/assets/2131354/de7f72e4-e73e-4700-914a-2e6ea215c294

Chrome:

https://github.com/box/box-content-preview/assets/2131354/2db2f96f-a460-4d93-9c2d-d7802fbcf46d

Safari:

https://github.com/box/box-content-preview/assets/2131354/e9fd43f2-5807-4539-91f1-26fdb38c8a6a

Edge:

https://github.com/box/box-content-preview/assets/2131354/782a48e4-8505-4917-8484-02ee6d381893