question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove Paragraph Tag from Alert Body

See original GitHub issue

Bug Report

Description

Currently the terra-alert module wraps the body of the alert in a <p> tag. This proves problematic if a consumer uses HTML elements (which the docs state is valid input) in body of the alert as the react DOM validator outputs a warning. I have a attached a screenshot of the warning from the console below.

Steps to Reproduce

  1. Create a Terra Alert in a test site.
  2. Place a <div> element (or a Terra element that uses a <div> inside the alert as a child element.
  3. Observe the warning in the console.

Additional Context / Screenshots

screen shot 2018-11-28 at 3 44 15 pm

Expected Behavior

I would expect that when I use HTML elements (besides a <span>, for some reason it does not complain about a <span> tag) or other Terra elements that use divs under the hood to not print an error.

Possible Solution

Change the Terra Alert component to use a <div> for the body instead of a <p> tag.

Environment

  • Component Name and Version: terra-alert 2.33.0
  • Browser Name and Version: Google Chrome 70.0.3538.110
  • Node/npm Version: Node 8.4 npm 5.3
  • Webpack Version: 4
  • Operating System and version (desktop or mobile): macOS desktop

@ Mentions

@tbiethman

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
JakeLaCombecommented, Jan 24, 2019

@gabeparra01 you are welcome to contribute this! It would be appreciated!

2reactions
JakeLaCombecommented, Nov 29, 2018

I did a screen reader test with Jaws and Voiceover using a div instead of a paragraph. We wanted to make sure that the title and message read as a seamless statement to browsers, and it used to break on the title with a pause before reading the alert. It must have been a style change, not a markup that changed that, so I would be okay with using a div instead of a p for alert. I do see this as a valid case for an alert banner, but I would like to double check with our designer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove HTML tags from a javascript string - Stack Overflow
and I want to remove all <p> and </p> tags from the above string. Just want to display the string values without html...
Read more >
Strip HTML Tags in JavaScript - CSS-Tricks
This solution is great for using of inner content from paragraph in JS Alert window – it strips nbsp and em efectivelly,
Read more >
How to strip out HTML tags from a string using JavaScript
To strip out all the HTML tags from a string there are lots of procedures in JavaScript. In order to strip out tags...
Read more >
Deep dive - Summernote
The tags can be specified just by tag name (as with p or pre or h1 - h6 above). ... Dialogs can be...
Read more >
How to remove the HTML tags that are displaying in the text
Use this to remove HTML tags from rich text area field in JavaScript: const strippedString = htmlString.replace(/(<([^>]+)>)/gi, ""); console.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found