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.

Modal not usable without JavaScript. No Fallback

See original GitHub issue

A modal is hidden by default, which makes it not usable if one wants to statically show a modal dialog for a user, which might not have JavaScript enabled.

As you can see in this JSBin example one can use d-block or style="display:block" to force showing the modal and also manually add the backdrop to the html without JavaScript, but the resulting modal is not “JavaScript-enabled”. It is not possible to dismiss it by clicking the X or the backdrop.

So at the moment, when showing a Modal to non-JavaScript users the modal has reduced functunality for users with Javacript (In comparison to what would be “possible” for these users). But to add the missing functionality one has to hide the modal for non-JavaScript users which is not an option, because they need to be able to see/use it as well.

I would prefer if users with JavaScript would have access to the full functionality without completely removing the functionality for non-JavaScript users.

EDIT: This issue is kind of related to #24939. If the Javascript code would have an option to read an already shown modal from the DOM both issues could be fixed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
bkdotcomcommented, Feb 15, 2018

<a data-toggle="modal" data-target="#myModal" href="some url explaining it's 2018">No JS fallback</a>

2reactions
bkdotcomcommented, Feb 14, 2018

If you want the modal open on page load add style="display:block;" to the modal

add <div class="modal-backdrop show"></div> at the end of the page if you want the backdrop

add class="modal-open" to your <body> tag if you don’t want the page to scroll

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modal not working properly, CSS not populating, <span> broken
When I would go to open one modal, both modals would appear. I have solved that problem, but now only the first modal...
Read more >
Considerations for Styling a Modal | CSS-Tricks
Having a close button that is always visible seems smart, so the user can't be in a state where it's not visibly clear...
Read more >
modal - CSS: Cascading Style Sheets - MDN Web Docs
The :modal CSS pseudo-class matches an element that is in a state in which it excludes all interaction with elements outside it until...
Read more >
I Used The Web For A Day With JavaScript Turned Off
I was warned that the grid view was not supported without JavaScript. WordPress media list view (fallback) Who needs grids anyway?
Read more >
Does not provide fallback content when JavaScript is not ...
# How to ensure your page has content without JavaScript. Progressive enhancement is a large and contentious topic. One camp says that, in...
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