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

Implement progressbar with <progress> #147

Open
rmarronnier opened this issue Feb 1, 2021 · 0 comments
Open

Implement progressbar with <progress> #147

rmarronnier opened this issue Feb 1, 2021 · 0 comments

Comments

@rmarronnier
Copy link

Right now Turbo can add a progressbar to the DOM.
It does this by inserting a div. Why not use the standard progress HTML element ? This way, no need for a default CSS styling. WDYT ?

seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Feb 7, 2021
Closes hotwired#61
Closes hotwired#147

---

Extends the `Adapter` interface to support new
`formSubmissionStarted(FormSubmission)` and
`formSubmissionFinished(FormSubmission)` delegate methods to hook into a
page's form submission lifecycle. Making the Adapter aware of form
submissions provides an opportunity to show and hide the progress bar in
the same way as driving the page with Visits.

Additionally, replace the `HTMLDivElement` implementation of the
progress bar with a [progress][] element and an instance of
[HTMLProgressElement][]. When updating the progress, set the
`HTMLProgressElement.value` attribute, and let the browser-native
implementation update its width. Since the element's `value` attribute
is accessible via a property, we no longer have to synchronize via
`requestAnimationFrame()`.

To support the built-in element, there are some proprietary
pseudoelements to consider across the browsers, including:

* [-moz-progress-bar][] for the Firefox bar
* [-webkit-progress-bar][] for the Safari and Chrome bar background
* [-webkit-progress-value][] for the Safari and Chrome bar progress
* [-ms-fill][] for IE bars

[progress]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress
[HTMLProgressElement]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLProgressElement
[-moz-progress-bar]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-moz-progress-bar
[-webkit-progress-bar]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-progress-bar
[-webkit-progress-value]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-progress-value
[-ms-fill]: https://developer.mozilla.org/en-US/docs/Archive/Web/CSS/::-ms-fill
seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Feb 7, 2021
Closes hotwired#61
Closes hotwired#147

---

Extends the `Adapter` interface to support new
`formSubmissionStarted(FormSubmission)` and
`formSubmissionFinished(FormSubmission)` delegate methods to hook into a
page's form submission lifecycle. Making the Adapter aware of form
submissions provides an opportunity to show and hide the progress bar in
the same way as driving the page with Visits.

Additionally, replace the `HTMLDivElement` implementation of the
progress bar with a [progress][] element and an instance of
[HTMLProgressElement][]. When updating the progress, set the
`HTMLProgressElement.value` attribute, and let the browser-native
implementation update its width. Since the element's `value` attribute
is accessible via a property, we no longer have to synchronize via
`requestAnimationFrame()`.

To support the built-in element, there are some proprietary
pseudoelements to consider across the browsers, including:

* [-moz-progress-bar][] for the Firefox bar
* [-webkit-progress-bar][] for the Safari and Chrome bar background
* [-webkit-progress-value][] for the Safari and Chrome bar progress
* [-ms-fill][] for IE bars

[progress]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress
[HTMLProgressElement]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLProgressElement
[-moz-progress-bar]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-moz-progress-bar
[-webkit-progress-bar]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-progress-bar
[-webkit-progress-value]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-progress-value
[-ms-fill]: https://developer.mozilla.org/en-US/docs/Archive/Web/CSS/::-ms-fill
seanpdoyle added a commit to seanpdoyle/turbo that referenced this issue Feb 7, 2021
Closes hotwired#61
Closes hotwired#147

---

Extends the `Adapter` interface to support new
`formSubmissionStarted(FormSubmission)` and
`formSubmissionFinished(FormSubmission)` delegate methods to hook into a
page's form submission lifecycle. Making the Adapter aware of form
submissions provides an opportunity to show and hide the progress bar in
the same way as driving the page with Visits.

Additionally, replace the `HTMLDivElement` implementation of the
progress bar with a [progress][] element and an instance of
[HTMLProgressElement][]. When updating the progress, set the
`HTMLProgressElement.value` attribute, and let the browser-native
implementation update its width. Since the element's `value` attribute
is accessible via a property, we no longer have to synchronize via
`requestAnimationFrame()`.

To support the built-in element, there are some proprietary
pseudoelements to consider across the browsers, including:

* [-moz-progress-bar][] for the Firefox bar
* [-webkit-progress-bar][] for the Safari and Chrome bar background
* [-webkit-progress-value][] for the Safari and Chrome bar progress
* [-ms-fill][] for IE bars

[progress]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress
[HTMLProgressElement]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLProgressElement
[-moz-progress-bar]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-moz-progress-bar
[-webkit-progress-bar]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-progress-bar
[-webkit-progress-value]: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-progress-value
[-ms-fill]: https://developer.mozilla.org/en-US/docs/Archive/Web/CSS/::-ms-fill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant