Giter Club home page Giter Club logo

ampersand-modal-view's Introduction

ampersand-modal-view

A modal popup view for Ampersand.js.

Install

npm install ampersand-modal-view

Example

var ModalView = require('ampersand-modal-view');
var MyCustomView = require('some-custom-view');

var modalContent = new MyCustomView(options);
var modal = new ModalView({
  title: 'Title of My Modal',
  description: 'a description, mostly for screenreaders',
  contentView: modalContent
});

modal.openIn('body');

API Reference

constructor/initialize new AmpersandModalView([opts])

Creates a new modal view.

opts

  • title, the title of the modal. Set in a h1. Used as the aria label.
  • description, sets a description for screenreaders. Used as the aria description
  • close, allows you to change the screenreader label for the close button.
  • contentView, any object following the Ampersand view conventions. The content of the modal.

open in modalView.openIn(container)

Opens the modal in container.

  • container, a string selector or a DOM node to show the modal inside. Most cases this will be body.

Accessibility

This modal takes great care to be accessible for people using a screenreader. The inspiration for the implementation comes from these two great articles.

License

MIT

ampersand-modal-view's People

Contributors

simme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

ampersand-modal-view's Issues

add example

Would be nice to see an example. Maybe on a gh-pages branch.

Question about visibility

I added the modal to my document using the default body container. When I go to open the modal I can see that it has been added, but for some reason it is not visible when viewing the document.

<div role="dialog" aria-hidden="true" aria-describedby="amp-modal-descr" data-hook="overlay" class="modal-overlay" style="display: block;">
<div class="modal-body" tabindex="0" role="document">
<button class="close" data-hook="close">
<span aria-hidden="true">×</span>
<span class="screenreader" data-hook="close-text">Close</span>
</button>
<h1 data-hook="title">Title of My Modal</h1>
<p id="amp-modal-descr" data-hook="description">a description, mostly for screenreaders</p>
<div data-hook="content"><p>One fine body…</p></div>
</div>
</div>

I notice the aria-hidden="true" is this what is causing it?

edit: I changed the container to render in and it is viewable but it inherited all the css of the parent container. I will work on it some more this is just user error I have a feeling.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.