kiwix-js
kiwix-js copied to clipboard
Add support for opening details sections in jQuery mode
This is the issue corresponding to #546. The issue is that in jQuery mode, in browsers that support the summary-details tags, details sections in recent ZIMs remain closed (because jQuery mode cannot run JS-in-the-ZIM). See the PR for more info.
With a user point of view, I tend to agree with you. But I'm not in favor of doing this in kiwix-js. We should report that on mwoffliner, instead of adding some ZIM-specific code.
It seems to me that there would be different proposals :
- revert the logic of showing/hiding the
detailstags, so that they all have theopenattribute in the HTML string, and then use javascript (inside the ZIM file) to close some of them if necessary (currently, it's the contrary : the tags are closed in the HTML string, and opened with javascript). It would give the same result (when javascript is enabled). But everything would be open by default when javascript is not enabled, which seems better for us in jQuery mode (at least on large screens) - remove the logic that closes the
detailstags when the screen is small, so that everything is open by default, whatever the screen size. It would not be consistent with online versions of wikipedia, but might be discussed - add an option for the user to choose if he prefers to have
detailsopen or closed. This could probably be implemented (in the future) through the JS API : https://github.com/openzim/mwoffliner/issues/596
I agree it's best to deal with this in the ZIM in the medium term. But the issue as I see it is:
- We currently have a workaround for opening sections that works for ZIMs without details-summary tags, so it would only be an addition/revision of our current workaround;
- Right now there are ZIMs being produced (August 2019) that ~~(I think?) are unusable with Kiwix JS because our current workaround no longer works. [I need to test this statement to be sure it's true!]~~ EDIT: experience is inconsistent, see post below.
So, while I am happy to report an issue on mwoffliner, my preference would be at least to make the new ZIMs usable until such time as the problem is fixed in mowoffliner. However, I completely understand your perspective. Let me corroborate 2. above and report back.
So I've now checked this against the very recent wikipedia_en_history_maxi_2019-08.zim. The ZIMs are usable in jQuery mode in all browsers, but there is an issue in browsers that support the details-summary tag syntax. In browsers that do not support the syntax, all sections are open by default. In browsers that do support the syntax, all h3, h4 sections are open, but oddly h2 sections are closed (by default). They can be opened by clicking on them. Most crucially, the References / Notes sections are closed, so clicking on a footnote fails to go to it. The average user will therefore think the ZIM has failed in some way. See screenshots below. So, oddly, there is a better user experience (in jQuery mode) for browsers that do not support details-summary tags (Edge 44 and Internet Explorer) than in browsers that do. I should add that h2 sections are closed on both big and small screens.


I have made this comment on mwoffliner. If our issue turns out not to be related to that issue, I'll promote it to a separate issue, but it seemed to be related.
@Jaifroid Do we really want to implement this feature in frozen JQuery mode?
Considering my PR wasn't accepted, and I don't have another solution, I agree this should be closed.