dhowe / ReadersJS

1 stars 4 forks source link

Uncaught error when all Readers are turned off #125

Closed shadoof closed 7 years ago

shadoof commented 7 years ago

This is reported when all Reader buttons are clicked off.

Uncaught TypeError: Cannot read property 'r' of undefined
    at getCSSFromColor (multi-page-ui.js:173)
    at assignFocus (multi-page-ui.js:146)
    at resetFocus (multi-page-ui.js:123)
    at readerOnOffEvent (multi-page-ui.js:160)
    at onReaderSingleClick (multi-page-ui.js:232)
    at multi-page-ui.js:259
cqx931 commented 7 years ago

https://github.com/dhowe/ReadersJS/blob/master/src/multi-page-ui.js#L174 I have added code here to make sure that there is always one active reader. Please let me know whether you think this is a proper fix for this issue.

dhowe commented 7 years ago

Is there a reason not to allow all readers to be turned off ?

cqx931 commented 7 years ago

It makes more sense to me to leave at least one active reader on the screen... The interface is there to enable users to see readers in different combinations and styles, but the focus is till the reader...

dhowe commented 7 years ago

there is the case where the user just wants to read the text without distraction or page-flipping... @shadoof ?

shadoof commented 7 years ago

I think that it should be possible to turn off all the readers. Not only for the use-case above (just to read the text as a human) but also for presentation contexts when you want to have the Readers framework displayed and read to go, with no distractions, as you make introductory remarks.

cqx931 commented 7 years ago

The readers can be all turned off without error message now. https://github.com/dhowe/ReadersJS/commit/a6670cbe2b6f651397ba3fe578ce5a4b014b921b

cqx931 commented 7 years ago

fixed and close