Skip to content

docs: updating guidance for conditional class application #824

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

Merged
merged 1 commit into from
Jan 22, 2021

Conversation

OvidijusParsiunas
Copy link
Contributor

@OvidijusParsiunas OvidijusParsiunas commented Jan 21, 2021

Description of Problem

The guidance for using conditional classes is a little bit misleading as the following:

<div :class="[isActive ? activeClass : '', errorClass]"></div>

'This will always apply errorClass, but will only apply activeClass when isActiveis truthy.'

Can be misinterpreted as:
'This will always apply errorClass, however when isActive is truthy, it will ONLY apply activeClass and nothing else.'

I personally had to take time to test the code myself in order to verify the actual behaviour, which should not be a requirement for documentation readers.

Proposed Solution

I renamed the above to:
'This will always apply errorClass, but activeClass will only be applied when isActive is truthy.'

Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OvidijusParsiunas thank you for the rewording! I agree, this sounds a bit more clear 👍🏻

@NataliaTepluhina NataliaTepluhina merged commit 02c87af into vuejs:master Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants