Code Monkey home page Code Monkey logo

Comments (3)

samuelsycamore avatar samuelsycamore commented on April 29, 2024

Hi @ishub-mobi, can you share a minimal reproduction of your code that shows the issue you're facing?

from material-ui.

github-actions avatar github-actions commented on April 29, 2024

Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information.

from material-ui.

ishub-mobi avatar ishub-mobi commented on April 29, 2024

Hi @ishub-mobi, can you share a minimal reproduction of your code that shows the issue you're facing?

Hi @samuelsycamore ,

When I add aria-required attribute in the select component itself like:

              <Select
                labelId="select_county"
                id="county_id"
                name="county_id"
                defaultValue=""
                // IconComponent={() => <CustomIcon />}

                displayEmpty={true}
                {...register("county_id", {
                  required: "Party selection is required",
                })}
                value={watch("county_id")}
                onChange={(e) => {
                  const selectedValue = e.target.value;

                  setValue("district_id", 0);
                  setValue("division_id", 0);
                  setValue("running-for", 0);
                  setValue("county_id", selectedValue, {
                    shouldValidate: true,
                  });
                  handleChange(e);
                }}
                renderValue={(selectedValue) => {
                  const countyItem = country.find(
                    (item) => item.id === selectedValue
                  );
                  return countyItem ? countyItem.name.toUpperCase() : "";
                }}
                inputProps={{
                  sx: {
                    "&::placeholder": {
                      color: "#67666C",
                      opacity: 1,
                    },
                  },
                }}
                aria-required="true"  
              >
              
              so it is going in the .MuiInputBase-root element, where it should go to the element where we are using role="combobox", which is the .MuiSelect-select  element (Please check the image of inspected element)

Bceause of this Screen reader unable to read it as required field, and some automated tools (like AXE, Wave, etc) throwing error that aria attribute used without a propper role

image

and when I'm suign aria-attribute in the inputProps of it is showing in the input element but, I'm not using the native select.
inputProps={{
sx: {
"&::placeholder": {
color: "#67666C",
opacity: 1,
},
},
"aria-required":"true"
}}

I hope you understood the problem, let me if you need anything else

from material-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.