Accordeon button with svg not changing plus to minus and contrary while collapsing - svg

I need to change plus to minus (contrary too) while collapsing accordeon tab which is written with svg.
When I click on tab, tab collapses, but plus not changing to minus, and minus to plus.
Here is html code:
<div class="accordion pt-2 w-100" id="myAccordion">
<div class="accordion-item">
<div class="accordion-header" id="headingOne">
<button type="button" class="accordion-btn collapsed btn text-left p-2 btn-light btn-block" data-bs-toggle="collapse" data-bs-target="#collapseOne"
aria-expanded="false" aria-controls="accordion-1" style="overflow-anchor: none;">
<svg viewBox="0 0 16 16" width="1em" height="1em" focusable="false" role="img" aria-label="plus square" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi-plus-square text-dark b-icon bi">
<g transform="translate(8 8) scale(0.8 0.8) translate(-8 -8)">
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"></path>
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"></path>
</g>
</svg>
<span class="ml-1 h4 text-dark">Tab1</span>
</button>
</div>
<div id="collapseOne" class="accordion-collapse collapse" data-bs-parent="#myAccordion">
<div class="card-body">
<p class="card-text">
Lorem ipsum dolor sit
</p>
</div>
</div>
</div>
<div class="accordion-item">
<div class="accordion-header" id="headingOne">
<button type="button" class="accordion-btn collapsed btn text-left p-2 btn-light btn-block collapsed" data-bs-toggle="collapse" data-bs-target="#collapseTwo"
aria-expanded="false" aria-controls="accordion-1" style="overflow-anchor: none;">
<svg viewBox="0 0 16 16" width="1em" height="1em" focusable="false" role="img" aria-label="plus square" xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi-plus-square text-dark b-icon bi">
<g transform="translate(8 8) scale(0.8 0.8) translate(-8 -8)">
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"></path>
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"></path>
</g>
</svg>
<span class="ml-1 h4 text-dark">Tab2</span>
</button>
</div>
<div id="collapseTwo" class="accordion-collapse collapse" data-bs-parent="#myAccordion">
<div class="card-body">
<p class="card-text">
Lorem ipsum dolor sit
</p>
</div>
</div>
</div>
</div>
Also here I have css code for accordeon:
.accordion-btn {
font-size: 24px;
}
.accordion-button::after {
position: absolute;
left: 0;
}
Thanks!

Related

How to transverse from parent element to child element in puppeteer

<div class="MuiGrid-root jss62 MuiGrid-item MuiGrid-grid-xs-12"><div class="MuiGrid-root jss107" style="background: linear-gradient(to left, rgb(244, 67, 54) 40%, lightgrey 150%); box-shadow: rgba(0, 0, 0, 0.25) 0px 1px 8px 8px; border: 1.5px solid rgba(0, 0, 0, 0.3);"><div class="MuiCardHeader-root"><div class="MuiCardHeader-avatar"><span class="material-icons MuiIcon-root jss112 MuiIcon-fontSizeLarge" aria-hidden="true">airplanemode_active</span></div><div class="MuiCardHeader-content"><span class="MuiTypography-root MuiCardHeader-title jss110 MuiTypography-body2 MuiTypography-displayBlock">Card-662</span><span class="MuiTypography-root MuiCardHeader-subheader jss111 MuiTypography-body2 MuiTypography-colorTextSecondary MuiTypography-displayBlock">09/30/2021</span></div><div class="MuiCardHeader-action"><div><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="Activate"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"></path></svg></span><span class="MuiTouchRipple-root"></span></button><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="Edit"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 00-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg></span><span class="MuiTouchRipple-root"></span></button><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="delete"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></svg></span><span class="MuiTouchRipple-root"></span></button></div></div></div><div class="MuiCardContent-root jss108"><h6 class="MuiTypography-root jss109 null MuiTypography-subtitle2">Card-661-description</h6></div></div><div class="MuiGrid-root jss107" style="background: linear-gradient(to left, rgb(244, 67, 54) 40%, lightgrey 150%);"><div class="MuiCardHeader-root"><div class="MuiCardHeader-avatar"><span class="material-icons MuiIcon-root jss112 MuiIcon-fontSizeLarge" aria-hidden="true">airplanemode_active</span></div><div class="MuiCardHeader-content"><span class="MuiTypography-root MuiCardHeader-title jss110 MuiTypography-body2 MuiTypography-displayBlock">Card-661</span><span class="MuiTypography-root MuiCardHeader-subheader jss111 MuiTypography-body2 MuiTypography-colorTextSecondary MuiTypography-displayBlock">09/30/2021</span></div><div class="MuiCardHeader-action"><div><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="Activate" title="Activate"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"></path></svg></span><span class="MuiTouchRipple-root"></span></button><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="Edit" title="Edit"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 00-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg></span><span class="MuiTouchRipple-root"></span></button><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="delete" title="Delete"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></svg></span><span class="MuiTouchRipple-root"></span></button></div></div></div><div class="MuiCardContent-root jss108"><h6 class="MuiTypography-root jss109 null MuiTypography-subtitle2">Card-661-description</h6></div></div><div class="MuiGrid-root jss107" style="background: linear-gradient(to left, rgb(244, 67, 54) 40%, lightgrey 150%);"><div class="MuiCardHeader-root"><div class="MuiCardHeader-avatar"><span class="material-icons MuiIcon-root jss112 MuiIcon-fontSizeLarge" aria-hidden="true">airplanemode_active</span></div><div class="MuiCardHeader-content"><span class="MuiTypography-root MuiCardHeader-title jss110 MuiTypography-body2 MuiTypography-displayBlock">Card-64</span><span class="MuiTypography-root MuiCardHeader-subheader jss111 MuiTypography-body2 MuiTypography-colorTextSecondary MuiTypography-displayBlock">09/24/2021</span></div><div class="MuiCardHeader-action"><div><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="Activate" title="Activate"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"></path></svg></span><span class="MuiTouchRipple-root"></span></button><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="Edit" title="Edit"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 00-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg></span><span class="MuiTouchRipple-root"></span></button><button class="MuiButtonBase-root MuiIconButton-root jss112 MuiIconButton-sizeSmall" tabindex="0" type="button" aria-label="delete" title="Delete"><span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></svg></span><span class="MuiTouchRipple-root"></span></button></div></div></div><div class="MuiCardContent-root jss108"><h6 class="MuiTypography-root jss109 null MuiTypography-subtitle2">Card-64-description</h6></div></div></div>
i wanted to navigate to element, where we have "Card-662"text. can anyone please help me with the xpath?

How to change color of this svg icon?

I have the following svg icon that I want to change the color of to #2F855A:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path class="heroicon-ui" d="M8.7 14.7a1 1 0 0 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L12 11.42l-3.3 3.3z"/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path class="heroicon-ui" fill="#2F855A" d="M8.7 14.7a1 1 0 0 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L12 11.42l-3.3 3.3z"/>
</svg>
How do I do that?
.icon{
width:100px;
height:100px;
}
<svg class="icon" fill="none" stroke="#2f2f2f" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path></svg>
You need to use stroke attribute on svg. You can choose any value you want. for example stroke="#2f2f2f will set the color as dark gray.

How to change the color of an svg image?

I'm trying to change the color of this svg img, using TailwindCSS classes:
<svg class="fill-current text-white-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path class="heroicon-ui" d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2zm16 3.38V6H4v1.38l8 4 8-4zm0 2.24l-7.55 3.77a1 1 0 0 1-.9 0L4 9.62V18h16V9.62z"/></svg>
and I have the following:
<svg
class="fill-current text-white inline-block h-20 w-20"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path class="heroicon-ui" d="M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2zm16 3.38V6H4v1.38l8 4 8-4zm0 2.24l-7.55 3.77a1 1 0 0 1-.9 0L4 9.62V18h16V9.62z"/>
</svg>
But it doesn't work. What am I doing wrong?
In Tailwind, there is no text-white-500 it's just text-white.
So far you are doing it right by using fill-current. Simply added fill-current text-red-600. This will change the svg color to #E53E3E. Check the color palette

NVDA on Windows 10 Edge does not read dynamically updated messages

I have a dynamically updated notification section on my website inside my div class='notification'(the parent div is always there). when the success message appears, the NVDA screen reader in windows 10 edge does not read it. How can I make it read the message?
<div class="notification">
<h6 tabindex="0" role="alert" aria-live="polite" aria-busy="true">Changes saved successfully.</h6>
<button tabindex="1" type="button" data-testid="dismiss-button" aria-label="Dismiss">
<span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>
</span>
</button>
</div>
Try to do something like this:
<div class="notification" aria-labelledby="my-message">
<h6 id="my-message" tabindex="0" role="alert" aria-live="polite" aria-busy="true">Changes saved successfully.</h6>
<button tabindex="1" type="button" data-testid="dismiss-button" aria-label="Dismiss">
<span class="MuiIconButton-label"><svg class="MuiSvgIcon-root" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>
</span>
</button>
</div>

SVG feColorMatrix doesn't work in safari

I have a fairly simple setup where I want to alter the color of the svg image by using an svg filter:
<svg style="height: 0;">
<filter id="hover" color-interpolation-filters="sRGB"
x="0" y="0" height="100%" width="100%">
<feColorMatrix type="matrix"
values="
0 0 0 0 0
0 0 0 0 0.68
0 0 0 0 0.94
0 0 0 1 0
"
/>
</filter>
</svg>
<img style="-webkit-filter: url('#hover'); filter: url('#hover');"
src="https://upload.wikimedia.org/wikipedia/commons/8/81/Wikimedia-logo.svg" alt="" />
Please see the attached codepen for details.
It's working in firefox and chrome, but I can't seem to find the problem in safari. According to caniuse, support should be ok.
So, this is going to seem silly - but it's the initial linebreak in your filter that's throwing it off. Correcting it to:
<feColorMatrix type="matrix"
values="0 0 0 0 0
0 0 0 0 0.68
0 0 0 0 0.94
0 0 0 1 0
"
/>
... works perfectly. (Incidentally, at one point, IE couldn't handle linebreaks in the values array in any position - you had to put them all on one line.)

Resources