Skip to content
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

Add a query parameter allowLinks=false #592

Closed
samreid opened this issue Dec 12, 2019 · 11 comments
Closed

Add a query parameter allowLinks=false #592

samreid opened this issue Dec 12, 2019 · 11 comments

Comments

@samreid
Copy link
Member

samreid commented Dec 12, 2019

From today's discussion, we would like to add a query parameter allowLinks=false, so that links can't be followed out of the sim.

@samreid samreid self-assigned this Dec 12, 2019
samreid added a commit to phetsims/chipper that referenced this issue Dec 12, 2019
@samreid
Copy link
Member Author

samreid commented Dec 12, 2019

I added this support above. @zepumph has more notes from this discussion. @jessegreenberg I noticed

      // a11y
      tagName: 'div'

In the other VBox, should it be added to the sub-VBox as well?

@zepumph can you please review?

@pixelzoom
Copy link
Contributor

Yesterday we speculated that the About dialog was the only place where hyperlinks appear. That's not the case - Molecule Polarity has a link in the "Real Molecules" screen, see screenshot below. According to @ariel-phet and @kathy-phet, we don't need to do anything about this.

screenshot_23

@zepumph
Copy link
Member

zepumph commented Dec 13, 2019

should it be added to the sub-VBox as well?

I don't think so. In general proliferation of div elements in the PDOM is less than ideal.

I feel like this should also be implemented to support other common code links, even if they are not totally needed at this time, for completeness. Through my search I found two more spots:

UpdateNodes has a linked RichText than ends up in the AboutDialog when out of date. I propose that UpdateNodes.createOutOfDateAboutNode changes to:

    createOutOfDateAboutNode: function( options ) {
      const linkNode = phet.chipper.queryParameters.allowLinks ? new RichText( '<a href="{{url}}">' + updatesOutOfDateString + '</a>', {
        links: { url: updateCheck.updateURL }, // RichText must fill in URL for link
        font: updateTextFont
      } ) : new Node();
      return new HBox( merge( {
        spacing: 8,
        cursor: 'pointer',
        maxWidth: MAX_WIDTH,
        children: [
          new FontAwesomeNode( 'warning_sign', { fill: '#E87600', scale: 0.5 } ), // "safety orange", according to Wikipedia
          linkNode
        ],

        // a11y
        tagName: 'div'
      }, options ) );
    },

UpdateNodes turned me onto PHET_CORE/openPopup and made me wonder if we should wrap that functions around an allowLinks check.

What do you think about these improvements?

@zepumph zepumph assigned samreid and unassigned zepumph Jan 4, 2020
@zepumph
Copy link
Member

zepumph commented Jan 4, 2020

Back to you @samreid, sorry I didn't do so earlier.

@samreid
Copy link
Member Author

samreid commented Jan 8, 2020

It seems like we should address this before making more releases.

@jessegreenberg
Copy link
Contributor

Regarding #592 (comment)

I agree with @zepumph, it is only needed for the container of all dialog content.

@jessegreenberg jessegreenberg removed their assignment Jan 9, 2020
@samreid
Copy link
Member Author

samreid commented Jan 16, 2020

At the previous dev meeting, we agreed I need to understand the recommendations in #592 (comment) better and coordinate with @zepumph on next steps.

@samreid
Copy link
Member Author

samreid commented Jan 16, 2020

With the proposed code, the about dialog looks like this:

image

I'll add the text, but make it non-linked and non-pointered.

@samreid
Copy link
Member Author

samreid commented Jan 16, 2020

I committed the revision above, here is a patch to facilitate testing:

Index: js/AboutDialog.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- js/AboutDialog.js	(revision f3b2bd1f971e34b965d30889b64d771b5adcd687)
+++ js/AboutDialog.js	(date 1579185559926)
@@ -71,7 +71,7 @@
       } ) );
     }
 
-    if ( updateCheck.areUpdatesChecked ) {
+    if ( updateCheck.areUpdatesChecked || true ) {
       const positionOptions = { left: 0, top: 0 };
       const checkingNode = UpdateNodes.createCheckingNode( positionOptions );
       const upToDateNode = UpdateNodes.createUpToDateNode( positionOptions );
@@ -83,6 +83,7 @@
 
       // @private {function(UpdateState)} - Listener that should be called whenever our update state changes (while we are displayed)
       this.updateVisibilityListener = function( state ) {
+        state = UpdateState.OUT_OF_DATE;
         checkingNode.visible = state === UpdateState.CHECKING;
         upToDateNode.visible = state === UpdateState.UP_TO_DATE;
         outOfDateNode.visible = state === UpdateState.OUT_OF_DATE;

@zepumph can you please review at your convenience?

@samreid samreid assigned zepumph and unassigned samreid Jan 16, 2020
@zepumph
Copy link
Member

zepumph commented Jan 17, 2020

This is really nice! I especially like the ternary around setting links. That feels suave to me. No other thoughts here.

@zepumph zepumph assigned samreid and unassigned zepumph Jan 17, 2020
@samreid
Copy link
Member Author

samreid commented Jan 19, 2020

Thanks, it seems this issue is ready to close.

@samreid samreid closed this as completed Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants