No longer use a single semicolon as separator between title and message with ui.browseableMessage#14668
Conversation
…rowseableMessage, for less ambiguity when separating title from message. Used same regex split string in message.html, as now used in ui.browseableMessage Removed an apparently unnecessary blank line from the top of message.html
|
@seanbudd Two things:
|
See test results for failed build of commit 6e7a3d185a |
|
I'm reasonably sure none of these failed system tests result from this PR's changes. |
|
@XLTechie two points:
|
|
1. Using a very unlikely string as a separator, the code would not be waterproof to an hypothetical situation with a link containing the same string, e.g.
It was far less waterproof with a simple semicolon.
reading NVDA's code itself where each line or variable/token would be a link.
Do you know any real world example of that that would apply here? It is a string
used inside a variable, which is then passed through the mshtml library to
a javascript function.
Does anything really do HTML annotations of the contents of strings?
Have you investigated an alternative solution with encapsulation of each argument, e.g. with double quotes, and escaping or doubling the encapsulation character in the encapsulated content?
We would need a Python function which encodes (escapes) HTML within double
quotes, and a javascript function which agrees with it on the other side to
decode it back into a string which can be split unambiguously.
I am attempting now to do it with JSON, as I would like something that allows individual properties without splitting.
A possible alternate solution I have just thought of, is to prepend the
title string with the length of the title string, then add the message.
Split it with substring() on the javascript side.
If I can't get it to accept JSON, I may try this.
2. I do not think that this PR is considered API braking change. Fixing obviously bugged functions (thus changing their result) has never been considered API-breaking and it does not make sense to me.
I tend to agree with you. However, I'm not NV Access. It is their consideration
to make. It was not strictly a bug, just a bad implementation.
|
I fully agree and this PR as is is already a great improvement that should handle almost (if not all) the issues.
Not at all. As written before, it was just an hypothetical example but not a know real-life case. I was imagining an online code browser where each line of code would be a link. The issue would then not be solved in case you browse the code of this very PR. |
|
@CyrilleB79, in response to your comments, I wrote:
And the result, after much banging head against wall, is to learn that mshtml is running in compatibility mode, and therefore does not support the JSON object. Unless Microsoft is going to change mshtml as they remove IE from people's machines, we are left with few options but to either include a JSON library in message.html, or use another approach. I suspect NV Access would not want a third party JSON library included. I have looked at passing other types than string through The last two ideas I've had, are base64 encoding some kind of object and passing that; or the numeric offset method I described earlier. I would like to discover a robust way to pass an arbitrary number of isolated strings to the javascript, so that we have options for implementing features like those under discussion in #14641. I will continue to play with this as I have time. Suggestions appreciated. |
Link to issue number:
Fixes #14667
Summary of the issue:
If
ui.browseableMessagewas given a title containing a semicolon (;), the title would be broken at the semicolon, and the rest of the title would be rendered before (as part of) the message in the HTML portion of the window.This had the potential to result in unexpected outcomes, if the message content was HTML; not to mention being confusing for the user.
While this was noticed in relation to the Report link destination feature introduced by #14583, it did not result from that feature, and could have occurred prior to its introduction. It does however effect it significantly, as the title of the link the destination of which is being identified, is presented in the title of a ui.browseableMessage, if the command is called twice, or the alternate version of the command is mapped to a key.
Description of user facing changes
If a link name contains a semicolon, portions of that name will no longer appear along with the link address, when reporting link destination in its window version.
Description of development approach
Changed the regex separator string in
ui.browseableMessage, and in themessage.htmlfile, to one which should hopefully be much less likely to appear in the wild. Instead of a single semicolon (";"), the string is now "__NVDA:split-here__".Also removed the blank line from the top of
message.html. I know of no purpose for having a blank line there.Testing strategy:
ui.browseableMessage, such as NVDA+f, to make sure they act as expected.Known issues with pull request:
Change log entries:
This was introduced in beta. If fixed in beta, no user level change should need to be listed.
For Developers
Titles in
ui.browseableMessagecalls, can now include semicolons without side effects.Code Review Checklist: