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

feat(annotations): Add annotations-only controls #1446

Closed ivanthai closed 2 years ago

ivanthai commented 2 years ago

Added an annotations-only controls mode when selecting an annotations mode. This is to make more efficient use of the screen width real estate when viewing preview on mobile or embed experiences.

Implementation This feature is currently under a responsive-web feature flip which is controlled by EUA. This is why I chose to add it via configuration as to not force any changes onto any consumers of this library. This functionality can be toggled on by setting enableAnnotationsOnlyControls option to true when instantiating new Preview()

I also opted in to making most of the changes via CSS rather than via React props (which was my first attempt). This to me is a bit more elegant and cleaner as it doesn't require massive changes to the React components.

Also open to any changes to config naming

Design

https://zpl.io/dxDDLEp

image

Demo

DocViewer

annotation-only-controls-mobile-demo-final

ImageViewer

annotations-only-controls-image-viewer-demo

With old "Exit Annotation" Button

annotation-only-mode-demo

Keyboard navigation - a11y annotations-only-controls-a11y-keyboard

ivanthai commented 2 years ago

I've added a gif to illustrate the keyboard navigation behavior in the description above

ivanthai commented 2 years ago

I've updated the description with new gifs