-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline figures in markdown #1138
Comments
I like it, @rviscomi as described, agree that additional meta would provide better UX. I was working on a similar scheme fairly recently. I'll go back and see if there's anything that might be useful in meeting your objectives. |
Thanks for raising and definitely some improvements we could do here before we generate 2020 figures. A few comments:
This can certainly be automated to bring consistency.
Yes this probably makes sense. Will think on it some more.
100% agree!
Less in agreement with this. I do want to avoid making old links obsolete (or worse - point to wrong data) but not convinced moving away from numeric id's is the answer. Especially as the caption will likely still include the id as I think the text should be able to reference the figure number (e.g. "we can see in figure XXX that..."). One thing to be aware of is that we have in the past temporary removed figures resulting in changing automatically generated figure numbers, so need to be cautious that any automatic numbering is likely still to cause an issue here. And I think that could easily be missed these days since we automate the HTML generation so it's not part of the pull request anymore. Another thing to be aware of is that the 2019 Third Parties chapter doesn't have a figure 6. So I actually think the id should be set when the figure is inserted by author or analyst and shouldn't be automatically generated. Granted this means some re-ordering if new figures are added (e.g. large figures added during copy editing to break up long pieces of text) or removed, but that should be rare after publication.
I like this! It would require using ids for the SQL filename (which I don't like for same reason as we don't want to use them for image alt attributes), having a
Yes this is possible, and probably more robust than using jsdom during chapter generation. I would however give the figure id explicitly for reasons discussed above (also makes the numbering easier - especially if using different macros for big figures or none at all for tables for example).
Yes markdown tables are very limited so only use them for simple tables. Given my preference not to abstract the numbers , I'd suggest very simple macros in the language templates to allow for easy of translation: <figure id="{{ figure_id(1) }}" >
...
<figcaption>{{ self.caption(1, "Technical profile of a typical mobile user.") }}</figcaption> The Or, if do want to move away from numeric ids, then need to do this to allow the link, but can see that's already repetitive: <figure id="technical-profile" >
...
<figcaption>{{ self.caption(1, "technical-profile", "Technical profile of a typical mobile user.") }}</figcaption>
Agreed!
Disagree.. They will still be brittle as long as we use them in Descriptions and text (which I think we should!). Human readable IDs will require more effort (could reuse image filenames, but not all figures have images) and require repeating to get links working.
Disagree.
Agreed! |
To clarify, I'm not suggesting any changes to the way the figures appear other than prefixing with the chapter number, eg the figcaption will still say |
Yeah I get that. And do see benefit of a non-changing anchor id to avoid link rot, but see the following problems:
|
Oh and “human readable name” isn’t great for translations. Already a problem for image named admittedly but they often are in English, and aren’t really exposed to readers anyway - like figure ids would be in deep link URLs. |
One thing I may have communicated poorly is that I'm proposing figures' sequential number to be completely taken out of the markdown. Authors shouldn't have to count figures to determine what their number will be and hardcode that number in the document. What doesn't change is the semantic meaning of the figure, eg The problems you described could be solved with templating*. For example, the template could map figure names ( * Maybe not entirely with templating. If a figure is referenced before it's defined, I'm not sure that the template would already have its named mapped to the number. Need to think on this some more, but the compilation step may still be needed to scan through all figures first. Reusing the same SQL for multiple figures is a real concern, albeit not the common case. I think the templates should assume the common case where the figure name is the same as the SQL file name. If two figures need to map back to the same SQL file, we can support optional kwargs in the template macro. For example, if the flexbox and grid figures were queried in the same file: {%
figure(
# Figure ID corresponding to the `png` file name.
'flexbox-adoption',
# Figure caption.
'Adoption of flexbox.',
# ...
# Optional: ID corresponding to the `sql` file name.
sql_file='flexbox-grid'
)
%}
# [...]
{%
figure(
# Figure ID corresponding to the `png` file name.
'grid-adoption',
# Figure caption.
'Adoption of grid.',
# ...
# Optional: ID corresponding to the `sql` file name.
sql_file='flexbox-grid'
)
%} The same could be done for translations, although I don't think this is necessary. For example, we don't translate the page names in the URL, like the chapter title, {%
figure(
# Figure ID corresponding to the `png` and `sql` file names.
'flexbox-adoption',
# Figure caption.
'Adopción de flexbox.',
# ...
# Optional: Localized ID that overrides the figure ID in anchor names.
localized_id='flexbox-adopción'
)
%} (I assume macros support kwargs, but worst case if not we'd use different macros for each scenario) @bazzadp WDYT? |
Yes if we could solve the way of referencing the figures then I agree the numbering is less important and then there is real merit in getting rid of them completely. Not sure how to do this technically though but will have a play. May have to be a combination of jsdom code at generation and Jinja templating. Also like you’re idea of prefixing their if with Localisation could be solved with the id being set in the markdown as you say.
You’re starting to win me round with all these counter arguments! Now just need to think about how to do it! 😀 |
Moving discussion from #1589 (comment). I would suggest we make the |
My vote would be to keep the button as is. The point of this is to make it available for visually impaired readers (not all of whom will be using screen readers with access to Happy to hear other's thoughts on this. |
I'd like to explore ways to keep the "Show description" functionality accessible and discoverable while tidying up the UI. I do wonder if it would be a better fit in the figure menu options with the other metadata. I've reread #854 and my understanding is that it was important to make long-form descriptions of figures available to everyone, but the prominence of the show/hide functionality wasn't as critical. I think as long as we make the show/hide functionality available to everyone, the original intent of the feature is preserved. 📟 paging @juliemoynat in case they have opinions on this. |
Hi, the ticket is closed but I just would like to add a link about why you should not rely on icon-only buttons: https://axesslab.com/icons-ruining-interfaces/ Icons without label are not clear for everyone. Moreover, it can make it more difficult for people navigating with voice control to tell which button they want to click. This is just for your information because nothing has finally changed in the interface so, thank you ;-) |
Thanks @juliemoynat that's a good point. I wonder to what extent we can make assumptions about our users' familiarity with this kind of UI [anti]pattern, for example can we assume that they know that a three-dot icon is a menu? Or if there's a chance that anyone would be unfamiliar, does that make the question moot and necessitate a more descriptive label? I suppose we could add a "More" or "Options" label to the button, which may also require an adjustment to the layout. |
@rviscomi It depends :-) For example, for the Web Almanac website, I think we can reasonably imagine that users know what is the three-bars icon on the top-right corner in mobile view. For other websites, I personally used to add the work "Menu" beside the icon. For a three-dot icon in the Web Almanac website, I think it can depend on where it is and on the graphic design. This kind of icon is often not perceivable because it is a really thin icon. I would prefer to have a visible label because it's more accessible anyway (more understandable, more accessible with voice control, more visible). But this is not an obligation as long as you put at least a visually hidden label inside the button (like this : |
We have that already! <div class="figure-dropdown nav-dropdown">
<button class="nav-dropdown-btn" aria-expanded="false" title="Figure options…">
<span class="visually-hidden">Explore the results</span>
<svg aria-hidden="true" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"></path>
</svg>
</button> Though just spotted that cheeky I still think the Show Description doesn't belong in this menu and so have kept it outside for now where it has a more prominent, text-labelled button. |
@bazzadp Ah! I hadn't seen that icon-button. I see it now. I fully agree with you: the "Show description" element is at a better place bellow the image with a clearly visible labelled button. This is easier to find (you don't have to guess that there is a long description hidden behind a small icon-button). And it is more in the spirit of WCAG (see the G74 technique). |
I'd like to propose a change in the way figures are described by authors in the markdown and rendered internally.
In css.md, the corresponding markdown (using embedded HTML) for the figure above is:
One thing I'd like to improve is the figure numbering. The figure ID is automatically generated, but we're still manually writing
Figure 12
in the<figcaption>
and managing the IDs needed for the accessible description. Can all of this be automated? I'd also like to make all figure numbers unique and prefixed by chapter number. So rather thanFigure 12
this would beFigure 2.12
.The
fig12.png
image shouldn't be named according to its figure number. These names aren't descriptive and must be kept in sync with the figure ordering in the chapter. Instead, we should name figure images descriptively, likeflexbox-adoption.png
. We should use this name as the<figure id>
and permalink so that reordering figures wouldn't make old links obsolete.I would also love to see all figures accompanied by links to their metadata like the corresponding SQL file and results sheet. This would enable anyone to see how the metrics were calculated and run it themselves. This requires some design choices like how to provide these links unobtrusively and accessibly. My idea is a menu in the corner of the figure, similar to the HTTP Archive metrics:
Rather than generating figure numbers in the build process, I wonder if this could be done entirely in the templates. For example, could authors include a Jinja macro like this:
There are other kinds of figures, like big numbers:
Even though the markup for this figure is much simpler, I would love to see another macro to standardize the boilerplate across all chapters so that the developers have more centralized control over how these are generated. We could have a macro like this:
We should build some customizability into these macros. For example, we needed to adjust the appearance of the z-index "really big number" figure. Perhaps there could be an optional parameter for a classname to be added to the figure. This could be used to adjust the font size as in the z-index example, create "alternate" themes for the big numbers so that they're not all the same color, etc.
We also need to support other types of figures: tables, images, and videos. The 2019 Mobile Web chapter uses all three in the first three figures.
I think it's ok to include the
<figure>
HTML although it may be nice to use markdown tables when possible. It may be harder to get the<th>
elements right for both horizontal and vertical using only markdown. But we should have a solution to abstract away the figure numbering and IDing. For example:I've added
id="technical-profile"
to the<figure>
and{{ figure_number() }}
to the<figcaption>
. Thefigure_number
Jinja macro could generate a monotonically increasing figure number using shared state with the other figure macros. I'd love to hear any ideas to remove even more of the figure/figcaption boilerplate.Summary
cc @HTTPArchive/developers
The text was updated successfully, but these errors were encountered: