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

valueLabelTrue and valueLabelFalse props of <BooleanField> have no effect #4047

Closed
anewcoder1992 opened this issue Nov 26, 2019 · 3 comments
Closed
Assignees

Comments

@anewcoder1992
Copy link

anewcoder1992 commented Nov 26, 2019

What you were expecting:

If you need to override it, you can use the valueLabelTrue and valueLabelFalse props which both accept a string. Those strings may be translation keys:

<BooleanField source="published" valueLabelTrue="Has been published" valueLabelFalse="Has not been published yet" />

i want to override the display for bool value ,but it did not on effect.

Steps to reproduce:

              <List>
               <Datagrid rowClick={rowClick} expand={PostPanel} optimized>
                  <BooleanField
                       source="commentable"
                       label="resources.posts.fields.commentable_short"
                       sortable={false}
                       valueLabelTrue="Has been published" 
                       valueLabelFalse="Has not been published yet"
                   />
               </Datagrid>
      </List>
``` in simple  post list

**Environment**

* React-admin version:3.0
@fzaninotto fzaninotto changed the title <BooleanField source="published" valueLabelTrue="Has been published" valueLabelFalse="Has not been published yet" /> valueLabelTrue and valueLabelFalse props of <BooleanField> have no effect Nov 26, 2019
@fzaninotto
Copy link
Member

The doc says:

The BooleanField also includes an hidden text for accessibility (or to query in end to end tests). By default, it includes the translated label and the translated value, for example Published: false.

The valueLabelTrue and valueLabelFalse props do work, you just can't see the related text on a normal web browser. Only screen readers will say it.

That being said, we can do better and provide both a fallback for screen readers AND a tooltip for most users. I'm marking this as an enhancement.

@anewcoder1992
Copy link
Author

OK, got it

@djhi
Copy link
Collaborator

djhi commented Nov 27, 2019

Closed by #4054

@djhi djhi closed this as completed Nov 27, 2019
@djhi djhi added this to the 3.1.0 milestone Nov 27, 2019
@fzaninotto fzaninotto removed this from the 3.1.0 milestone Dec 17, 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