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

Jocupi/external link indication #3108

Closed

Conversation

JorgeCupiV
Copy link

Fixes #3087

Description

  • Add title for external and internal links
  • Add icon for external links

Specific Changes

  • The allowedAttributes in the SANITIZE_HTML_OPTIONS at the packages/bundle/src/renderMarkdown.js file now also take the new role and class attributes
  • A new function to verify if a link is external is added at the packages/bundle/src/renderMarkdown.js file
  • A new style is added to add an icon for external links and is located at the packages/component/src/Styles/StyleSet/TextContent.js file

@compulim
Copy link
Contributor

compulim commented Apr 16, 2020

  • Add test case
  • Do not load external resources, e.g. from Wikipedia
    • Image need to be verified by designer team
  • Localization
  • Verify accessibility

Copy link

@ericmaino ericmaino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments. It also looks like there is a failing test that needs to be addressed.

@@ -7,7 +7,7 @@ import sanitizeHTML from 'sanitize-html';

const SANITIZE_HTML_OPTIONS = {
allowedAttributes: {
a: ['aria-label', 'href', 'name', 'target', 'title'],
a: ['aria-label', 'href', 'name', 'target', 'title', 'role', 'class'],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that 'class' belongs in this list. As my understanding is that these are supported markdown attributes and we don't want the markdown author to support overriding this behavior.

It also looks like role was added as part of this change, but not necessarily used. It might be left over from another change you inherited.

}

const urlAttrIndex = tokens[index].attrIndex('href');
if (isExternal(urlAttrIndex)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be conditionally added since the markdown author could supply their own title

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on the condition part? In the commit 6039f00 I'm adding localized strings as also requested by @compulim

packages/component/src/Styles/StyleSet/TextContent.js Outdated Show resolved Hide resolved
@corinagum
Copy link
Contributor

Is there an update for this PR? There are a number of tree changes to Web Chat incoming, so my recommendation is to close this PR and open a new one. Please be sure to address compulim's comments above before filing the new PR.

@corinagum corinagum closed this Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants