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

Align ngbProgressBar [max] API with native <progress> element #3390

Closed
peterblazejewicz opened this issue Oct 2, 2019 · 3 comments
Closed

Comments

@peterblazejewicz
Copy link
Contributor

Bug description:

Surfaced in #3386

In the native progress max value, if present, should be always greater then zero and have a default value 1:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress#Attributes

The ngbProgressbar is not a native progress element, but probably it should adhere to implementation details.
If the max is being set to zero (FoL) by user as in #3386, this results in the NaN value returned internally and displayed by implementation. At the same time the assistive technology attributes are set to 0 for value and for max with the aria attributes.

I think adhering to default behavior would results in meaningful value being set and displayed.
In that practical case it would read 25 past the 1 (100%, finished). See native:

https://codepen.io/blazejewicz/pen/zYOgXPW?&editable=true

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/edit/angular-ngb-progressbar-max

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: n/a

ng-bootstrap: 5.1.1

Bootstrap:
n/a

@maxokorokov
Copy link
Member

Just a question of the default max value I guess. Bootstrap prefers to have aria-valuemax="100" and we're mapping [max] directly to air-valuemax. I feel like it's more convenient also to have 100, not 1 and we have it clearly documented, so don't see any reason to change this at the moment.

#3386 is a display issue to me, when style=width:... is not set at all when max === 0.

Will mark this as a feature request and a breaking change for now.

@maxokorokov maxokorokov changed the title ngProgressBar getPercentage returns NaN Align ngbProgressBar [max] API with native <progress> element Oct 4, 2019
@devoto13
Copy link
Contributor

devoto13 commented Oct 4, 2019

@peterblazejewicz Using 1 as a fallback max value is not so good solution either. When the value is set to 0.5, then native progressbar will will be half-filled, while fully filled would be more semantically correct as it is 0.5 past 0 following your terminology.

Always fully filling the progressbar, when max=0 seems to be the most practical solution as I outlined in the #3386.

@peterblazejewicz
Copy link
Contributor Author

This is now covered by #3400 3400

@maxokorokov maxokorokov added this to the 5.1.3 milestone Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants