See this question about masking label so that they have an opaque background and show up better on a graph.
Assuming we have ironed out the technical challenges for such labels, the next question is how should we support adding an opague background to labels. Should there be an attribute like masked that could be true or false? If so, what should the default be?
Or, as mentioned in the developer discussion around creating this masking, should that even be an option or should we just always give labels an opaque background?
Just as a first thought: Draggable labels masked by default, fixed ones opt-in masking?
There’s plenty of times where I haven’t thought labels needed anything more. When labeling a graph with y=f(x) for instance, or labeling a fixed point A or B, masking seems like it would be overkill and look weird. But for draggable labels, masking seems like it should be the default.
Has there been any progress on masked labels? Here’s an activity where the default position of the label on the points when t=0 runs into the y-axis and is hard to read. Doenet
I found a workaround using conditional content and labels not actually attached to the points, but it’s not elegant. I commented that out for now just to better illustrate the problematic behavior.
I also discovered that trying to hide the label on the point when the x-coord is 0 does weird things on point A: I see unrendered latex in the label on all the other coordinates. This goes away and the label looks normal when I delete the hide attribute. Oddly enough, I don’t see the same problem if I try the exact same thing on point B.
But the easiest solution by far would be for the label to be set apart and on a closer layer than the axes without needing to mess with this stuff.
I need to investigate how far we got and see if the blockers from jsxgraph have been all taken care of. Linking to this issue to make it easier for me to find it.
I released a new dev version that, by default, masks all labels. If you want to restore the old behavior, you can set maskLabel="false" on the graphical object (e.g., point).
Amazing, thank you! You don’t know how much I’ve been messing with hide conditions and locations of labels depending on the location of various draggable elements.
But, can we make the behavior opt-in instead of opt out? There’s a lot of times I use labels for graphs where most things are fixed, and I don’t think I like having the mask on in that case.
A prime example is custom labeling of axes. I have been frequently turning off xAxis and yAxis ticks because the default often makes things very cluttered and I don’t have much control over the step and label increment. Instead, I’ve been using repeatForSequence to draw ticks and values labeled where I want them, and I think it looks weird to have those labels be masked. I’d rather opt in to masking when things are moving around and thus need to stay visible in various locations.
It is certainly easy to make the masking opt-in rather than opt-out.
Anyone have a counterargument and want to keep it opt-out?
Also, when masking is turned on, should those boxes always be visible? Or should they only be visible when moving the point (or never visible but just have the opaque background)?
I’m in favor of opt-in. I think it looks cleaner for them not to be masked. When you can see it is an issue (multiple layers for example), then it is easy to turn it on.
I didn’t realize until you asked the question that most of what I don’t like as default is the box outline. I’m not sure I’d notice opaque background or not on its own nearly as much. Would it be better in dark mode one way or the other? (Personally, I hate dark mode, but I know lots of people prefer it).
I’m okay with the box being visible only while dragging, but if it’s always visible when masking has been chosen, that’s fine, too.
I released a new dev version where the box around the label is only visible while dragging. I kept the default to be that labels are masked.
If that doesn’t address the main issue and we still want to have masked be false by default, let me know.
I would like for the existing behavior to be the default with the option to make the label opaque should one wish to do that.
2 Likes
OK. I released a new doenetml version that changed the default to maskLabel="false".
1 Like
I do not think label masking should be the default behavior. While masking can improve readability in some situations, it also introduces visual artifacts and can obscure important graph elements. More importantly, I think it addresses a symptom rather than the underlying issue.
One alternative approach is to reduce the visual prominence of the graph’s supporting elements, particularly gridlines and axes. In my own use of Doenet JSXGraph components, I found that the default grid styling often competed directly with labels for attention. By reducing the intensity and contrast of the grid and axis elements in both light and dark modes, labels become much easier to identify without requiring any masking.
This approach gives greater visual weight to the labels while still preserving the visibility of the graph itself. Even on relatively dense grids, labels remain legible because the background elements are no longer competing for attention. In contrast, with the current default Doenet styling, labels can become difficult to distinguish. For example, the b label denoting the region of integration can be nearly indecipherable because it intersects into the gridline with the same color-profile.
From an accessibility and design perspective, reducing nonessential visual contrast is often preferable to covering content behind a label. It preserves the integrity of the graph, avoids masking artifacts, and improves overall visual hierarchy. Labels should naturally stand out from their surroundings rather than requiring a background patch to remain readable.
Unfortunately, this is not currently an option available to most authors. I am only able to make these adjustments because I embed Doenet within external resources and generate the iFrames myself, which allows me to inject custom styling. If authors had more control over the appearance of grids, axes, and other background elements, the need for label masking would likely be reduced significantly. For that reason, I would prefer that masking remain an optional setting rather than becoming the default behavior, and options to control relative visual weights being exposed to content authors be explored.
That’s more confirmation that turning off masking labels by default was the right choice.
I think such styling is not something that an author should do in DoenetML. Instead, there should be something equivalent to the publisher settings that PreTeXt has. Those settings could include controls for styling. Though discussion of such a feature has come up before, it has not made it to level of definition that I would need to determine how to implement it. (I have more questions than answers about how it should work.)
A separate question is what the default styling of graphs should be in Doenet. Should we decrease the intensity and contrast of the grid and axes?
Duane