Skip to content

use existing role implementation rather than rolling our own#273

Open
s-cork wants to merge 1 commit into
masterfrom
role-prop
Open

use existing role implementation rather than rolling our own#273
s-cork wants to merge 1 commit into
masterfrom
role-prop

Conversation

@s-cork

@s-cork s-cork commented Mar 27, 2025

Copy link
Copy Markdown
Contributor

This change is potentially breaking - but since we're still in beta that's probably ok and would recommend doing a minor version bump.

But also - feel free to close this issue if it's not a desired change
I like that it's consistent (you will always get a role on the outer component)
but i see the advantages of the current approach

we were missing role property on text input and menu button (https://anvil.works/forum/t/m3-legacy-read-only-role-not-working-with-m3-dependency/23911/5)
this PR implements the role prop in the same way we implement the visible prop
i.e. bypass our form template custom component descriptor and instead use the HtmlTemplate's role descriptor.

This will change where the .anvil-role-X class is applied, and so users may find their current role code breaks, and will need to change code from

.anvil-role-my-role {
    color: red;
}

to something like

.anvil-role-my-role .anvil-m3-some-class {
    color: red;
}
/* or  something like*/
.anvil-role-my-role button {
    color: red;
}

This might not be the approach we actually want to take
so feel free to close this, and instead we can just add the missing role properties to TextInput and MenuItem

close #279

@s-cork
s-cork requested a review from bcm628 April 25, 2025 13:59
@daviesian
daviesian force-pushed the master branch 6 times, most recently from 481c80a to e84db02 Compare February 4, 2026 13:54
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.

dropdown_menu component is missing role property

1 participant