Unable to select option from social bar - html

I have made a sticky bar to contact me in HTML. [Image 1]
Image 1
code for the block :
[tag:
<!-- Social Sharing Bar -->
<div class="fixed right-0 bg-[#ffc113] top-40 z-50 px-5 py-3 flex flex-col space-y-3 w-16 border-solid border-2 border-neutral-900">
<!-- Call -->
<a href="#" class="" title="Call Us">
<svg fill="" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="..."></path>
</svg>
</a>
</div>
<div class="fixed right-0 bg-[#ffc113] top-52 z-50 -my-1 px-5 py-3 flex flex-col space-y-3 w-16 h-40 border-solid border-2 border-neutral-900">
<!-- Users -->
<a href="#enquire" class="h-16 -rotate-90 whitespace-nowrap h-24 my-7" title="Share on Twitter">
<p class="h-24 py-10 whitespace-nowrap">
Enquire Now
</p>
</a>
</div>
<div class="fixed right-0 bg-[#ffc113] top-80 z-50 px-5 py-3 flex flex-col space-y-3 w-16 border-solid border-2 border-neutral-900 socialbutton">
<!-- Users -->
<a href="#" title="Share on Twitter">
<svg fill="" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="..."></path>
</svg>
</a>
</div>
<div class="socialhide">
<!-- <div class="flex justify-center">
<button type="button" data-mdb-ripple="true" data-mdb-ripple-color="light" class="inline-block px-6 py-2.5 mb-2 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:shadow-lg focus:shadow-lg focus:outline-none focus:ring-0 active:shadow-lg transition duration-150 ease-in-out" style="background-color: #1877f2;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" class="w-4 h-4">
<path fill="currentColor" d="..."/>
</svg>
</button>
</div> -->
<div class="flex justify-center space-x-2">
<a href="#!" role="button">
<!-- Facebook -->
<svg xmlns="..." class="w-7 h-7" style="color: #1877f2;">
<path fill="currentColor" d="..."/></svg>
</a>
<a href="#!" role="button">
<!-- Instagram -->
<svg xmlns="..."/></svg>
</a>
<a href="#!" role="button">
<!-- Google -->
<svg xmlns="..."/></svg>
</a>
<a href="#!" role="button">
<!-- Twitter -->
<svg xmlns="..."/></svg>
</a>
</div>
</div>
<!-- Content -->]
So when I hover on the social button it should be stuck on the screen: (Image 2)
Image 2
But when I come to select any social media it fades away.
CSS Code :
.socialhide {
display: none;
}
.socialbutton:hover + .socialhide {
display: flex;
height: 48px;
align-items: center;
text-align: center;
justify-content: center;
/* color: red; */
position: fixed;
background: #ffc113;
right: 65px;
top: 39%;
flex-direction: column;
z-index: 999;
border: 2px solid black;
}
Thank you please help me.
I need the same social bar as its on the
https://www.brigadegroup.com/

As I can see you have hover state only for .socialbutton element, so when you hover over .socialhide display: none; applies. You also need to add a hover state for your .socialhide div, like that:
.socialhide {
display: none;
}
.socialhide:hover,
.socialbutton:hover + .socialhide {
display: flex;
height: 48px;
align-items: center;
text-align: center;
justify-content: center;
/* color: red; */
position: fixed;
background: #ffc113;
right: 65px;
top: 39%;
flex-direction: column;
z-index: 999;
border: 2px solid black;
}

Related

Html tailwindcss add border to li tag

I am using tailwindcss to create a side menu and I need some active indicator so I need to show the border at end of <li> tag.
Right now its showing like this:
<div class="bg-bgcolor h-screen">
<aside class="w-20 bg-white pt-2 rounded-2xl flex flex-col justify-center h-4/5">
<ul class="flex flex-col items-center">
<li>
<div class=" text-white bg-black p-2 rounded-2xl">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5}
stroke="currentColor" class="w-6 h-6">
<path strokeLinecap="round" strokeLinejoin="round"
d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
</svg>
</div>
</li>
</ul>
</aside>
</div>
I want to do it like this
You can simple add this few classes:
to <li> tag : pr-2 border-black border-r-2
padding right
border black
border on the right side
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<h1 class="text-3xl font-bold underline">
Hello world!
</h1>
<div class="bg-bgcolor h-screen">
<aside class="w-20 bg-white pt-2 rounded-2xl flex flex-col justify-center h-4/5">
<ul class="flex flex-col items-center">
<li class="pr-2 border-black border-r-2">
<div class="text-white bg-black p-2 rounded-2xl">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" class="w-6 h-6">
<path strokeLinecap="round" strokeLinejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
</svg>
</div>
</li>
</ul>
</aside>
</div>
</body>
</html>
To apply the right border to the element in the tailwind by using the "border-r-2" class and also more classes with border variants like "border-r-4", "border-r-8" etc.
In your case, you have to apply "border-r-2" to <li> elements like
<li class="border-r-2">
Hear the value "2" indicate border width,
For more information regarding the same here you can find the reference
https://tailwindcss.com/docs/border-width

Dropdown list not working as expected Tailwind css

I'm using tailwind with cdn, and just copy pasting one of the dropdown lists on flowbite:
<button id="dropdownDefault" data-dropdown-toggle="dropdown" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" type="button">Dropdown button <svg class="ml-2 w-4 h-4" aria-hidden="true" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg></button>
<!-- Dropdown menu -->
<div id="dropdown" class="z-10 w-44 bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700 block" data-popper-reference-hidden="" data-popper-escaped="" data-popper-placement="bottom" style="position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate3d(327px, 70px, 0px);">
<ul class="py-1 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdownDefault">
<li>
Dashboard
</li>
<li>
Settings
</li>
<li>
Earnings
</li>
<li>
Sign out
</li>
</ul>
</div>
But this is what I'm getting:
Any idea what could be causing this?
you need to include the FlowBite <script> before the end of the body element
also, require the minified stylesheet inside the <head> tag like this :
<head>
<link rel="stylesheet" href="https://unpkg.com/flowbite#1.5.1/dist/flowbite.min.css" />
</head>
<body>
<button id="dropdownDefault" data-dropdown-toggle="dropdown" class="inline-flex items-center rounded-lg bg-blue-700 px-4 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" type="button">
Dropdown busdatton <svg class="ml-2 h-4 w-4" aria-hidden="true" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
</button>
<!-- Dropdown menu -->
<div id="dropdown" class="z-10 block w-44 divide-y divide-gray-100 rounded bg-white shadow dark:bg-gray-700" data-popper-reference-hidden="" data-popper-escaped="" data-popper-placement="bottom" style="position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate3d(327px, 70px, 0px);">
<ul class="py-1 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdownDefault">
<li>
Dashboard
</li>
<li>
Settings
</li>
<li>
Earnings
</li>
<li>
Sign out
</li>
</ul>
</div>
<script src="https://unpkg.com/flowbite#1.5.1/dist/flowbite.js"></script>
</body>
Here an example without library, only react and tailwind.
const Sidebar = () => {
const [isOpen, setOpen] = useState(false);
const handleDropDown = () => {
setOpen(!isOpen);
};
return (
<div className="dropdown">
<button
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2.5 text-center inline-flex items-center"
onClick={handleDropDown}
>
Steps
<svg
className="ml-2 w-4 h-4"
aria-hidden="true"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M19 9l-7 7-7-7"
></path>
</svg>
</button>
<div
id="dropdown"
className={`z-10 w-44 bg-white rounded divide-y divide-gray-100 shadow ${
isOpen ? "block" : "hidden"
}`}
>
<ul className=" z-10 w-44 bg-white rounded divide-y divide-gray-100 shadow ">
<li
>
<a href="#" className="block py-2 px-4 hover:bg-gray-100">
blablabla
</a>
</li>
</ul>
</div>
</div>
);
};

How do i get my sticky navbar to work using tailwind css?

I am working on a website using tailwindcss. But for some reason the navbar wont work when using the "sticky" class. I tried using the "fixed" class instead, but that did not work with the banner. I have also tried to use:
nav {
position: -webkit-sticky;
position: sticky;
}
but it has been usuccessful. I have also used some other css and javascript to style the searchbar how i want it.
How can i get the navbar to always stick?
Here is the code for the nav and the banner:
<div>
<div>
<nav class="sticky w-full md:flex md:justify-between md:items-center md:flex-wrap px-10 md:px-48 bg-gray-200 py-2"> <!--Navigation-->
<div class="flex md:flex justify-between md:items-center"> <!--Title och Burger button-->
<h1 class="text-xl text-emerald-600">
Logo
</h1>
<div class="px-4 mt-1 justify-end cursor-pointer md:hidden" id="burger">
<svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</div>
</div>
<ul class="md:flex md:flex-1 hidden md:justify-around" id="menu">
<li class="text-">
Home
</li>
<li class="">
About
</li>
<li class="">
Products
</li>
</ul>
<div class="input-container"> <!--Searchbar-->
<input id="in" type="search" placeholder="Search for product" class="border-gray-black rounded-md p-0 input-search-field pl-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hero" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
<button class="md:pr-5">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</button>
</div>
<div class=""> <!--Login/Signup-->
Log in
Sign up
</div>
</nav>
</div>
<div class="relative w-full container"> <!--Banner-->
<img src="img/Banner.png" alt="">
<button class="btn px-4 py-3 bg-blue-600 rounded-md hover:bg-blue-700 transition ease-in-out">Check our products</button>
</div>
<main class="">
</main>
</div>
The css code i used for the searchbar:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
nav {
position: -webkit-sticky;
position: sticky;
}
.input-search-field::-webkit-search-cancel-button {
-webkit-appearance: none;
border-radius: 20px;
}
.input-search-field[type="search"] {
position: relative;
}
.input-container {
display: flex;
align-items: center;
position: relative;
}
.hero {
width: 15px;
position: absolute;
left: 150px;
cursor: pointer;
}
.container .btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
Javascript:
var result = document.querySelector('.hero').addEventListener('click', myfunction)
function myfunction() {
var input = document.querySelector('#in').value="";
}
console.log(result);
const burger = document.querySelector('#burger');
const menu = document.querySelector('#menu');
burger.addEventListener('click', () => {
if (menu.classList.contains('hidden')) {
menu.classList.remove('hidden');
} else {
menu.classList.add('hidden');
}
})
You have to give position sticky to div not in nav and also use top:0px;
HTML Code
<div class="sti">
<nav class="sticky w-full md:flex md:justify-between md:items-center md:flex-wrap px-10 md:px-48 bg-gray-200 py-2"> <!--Navigation-->
<div class="flex md:flex justify-between md:items-center"> <!--Title och Burger button-->
<h1 class="text-xl text-emerald-600">
Logo
</h1>
<div class="px-4 mt-1 justify-end cursor-pointer md:hidden" id="burger">
<svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</div>
</div>
<ul class="md:flex md:flex-1 hidden md:justify-around" id="menu">
<li class="text-">
Home
</li>
<li class="">
About
</li>
<li class="">
Products
</li>
</ul>
<div class="input-container"> <!--Searchbar-->
<input id="in" type="search" placeholder="Search for product" class="border-gray-black rounded-md p-0 input-search-field pl-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hero" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
<button class="md:pr-5">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</button>
</div>
<div class=""> <!--Login/Signup-->
Log in
Sign up
</div>
</nav>
</div>
CSS Code
.sti {
position: -webkit-sticky;
position: sticky;
top: 0px;
}

Overlay a Bootstrap Row completely

In many web environments with some degree of interaction among Users, if the platform allows, one can block another and effectively not even see the blocked person' posts.
Thinking about it, I decided to implement such a feature in a commenting system I made. Here's a fragment of it.
Through a class .blocked added to the wrapper of two Bootstrap 5 .row, I managed to style the pseudo-selector ::before to cover the whole content as desired, but in order to add some text in a non-hard-coded way, I ended up having to use a data-attribute.
It works, yes, but even though the visual background extends to the whole width, this added content does not, it gets limited by the width of these two rows within.
Also, it's not very much flexible as it limits my customization options, especially through Javascript, since I don't have other tags within to manipulate.
So, how could I accomplish my goal in a flexible way?
html,
body {
height: 100%;
width: 75%;
margin-top: 5%;
}
.wrapper {
min-height: 100vh;
height: 100vh;
}
main {
flex: 1;
}
/** This is not really hard-coded like, but... */
#comment_851030477 {
border: 1px solid black;
padding: 1rem;
}
.blocked {
background-color: #000;
display: flex;
bottom: 0;
left: 0;
position: relative;
top: 0;
}
.blocked>* {
visibility: hidden;
}
.blocked::before {
align-self: center;
color: #FFF;
content: attr(data-blocked);
display: flex;
margin: -1rem;
visibility: visible;
width: 100%;
}
.picture {
border: 1px solid blue;
}
/** Icons */
.icon {
-ms-flex-item-align: center;
align-self: center;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.icon.edit,
.icon.delete {
fill: rgba( var(--darker-gray));
height: 1.25rem;
width: 1.25rem;
}
.icon.block,
.icon.unblock {
fill: rgba( var(--darker-gray));
height: 1.25rem;
width: 1.25rem;
}
.icon.follow,
.icon.unfollow {
fill: rgba( var(--darker-gray));
height: 1.25rem;
width: 1.25rem;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<main class="container-fluid">
<div class="row w-100 px-3">
<div class="col">
<section>
<div class="container blocked" id="comment_851030477" data-blocked="THIS USER IS BLOCKED">
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="d-none block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
<div class="container mt-3" id="comment_851030477">
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture foil"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
</section>
</div>
</div>
</main>
After cooling down a bit, I decided to have all of the necessary markup ready with control-classes to be manipulated with Javascript.
This is the final result, despite the positioning awkwardness and the fact SVG icons remain visible here.
$( '#comments' ).on( 'click', '.blocked a.reveal', function() {
$( this ).closest( '.container' )
.removeClass( 'blocked' )
.find( '.blocked-overlay' )
.addClass( 'd-none' );
})
html, body {
height: 100%;
width: 75%;
margin-top: 5%;
}
.wrapper {
min-height: 100vh;
height: 100vh;
}
main {
flex: 1;
}
/** This is not really hard-coded like this, but... */
#comment_851030477 {
border: 1px solid black;
padding: 1rem;
position: relative;
}
.blocked .blocked-overlay {
background-color: #FFF;
display: flex;
flex-direction: column;
height: 100%;
justify-content: center;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 1;
}
.blocked .blocked-overlay .reveal {
margin-left: .3rem;
}
.picture {
border: 1px solid blue;
}
/** Icons */
.icon {
-ms-flex-item-align: center;
align-self: center;
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.icon.edit, .icon.delete {
fill: rgba( var(--darker-gray) );
height: 1.25rem;
width: 1.25rem;
}
.icon.block, .icon.unblock {
fill: rgba( var(--darker-gray) );
height: 1.25rem;
width: 1.25rem;
}
.icon.follow, .icon.unfollow {
fill: rgba( var(--darker-gray) );
height: 1.25rem;
width: 1.25rem;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"/>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body class="d-flex flex-column" data-loaded="true">
<main class="container-fluid">
<div class="row w-100 px-3">
<div class="col">
<section id="comments">
<div class="container blocked" id="comment_851030477">
<div class="blocked-overlay">
<p class="d-inline-flex justify-content-center">
You have blocked the author of this comment
</p>
<p class="d-inline-flex justify-content-center">
If you still want to see it,
<a href="javascript:void(0)" class="reveal">
<span>click here</span>
</a>
</p>
</div>
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="d-none block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
<div class="container mt-3" id="comment_851030477">
<div class="row gx-3">
<div class="d-flex col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 col-xxl-1 align-items-center picture foil"></div>
<div class="col align-self-center">
<div class="row">
<div class="col">
<div class="row flex-column author">
<div class="col display">Username</div>
<div class="col username">
<small class="text-muted">(#username)</small>
</div>
<div class="col date">
<small>Sunday, 30th May 2021</small>
</div>
</div>
</div>
<div class="col-2 d-flex flex-row justify-content-end tools">
<a href="javascript:void(0)" class="block">
<svg viewBox="0 0 32 28" class="icon block mx-2">
<title>Block</title>
<use xlink:href="#block"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unblock">
<svg viewBox="0 0 32 28" class="icon unblock mx-2">
<title>Unblock</title>
<use xlink:href="#unblock"></use>
</svg>
</a>
<a href="javascript:void(0)" class="follow d-none">
<svg viewBox="0 0 24 28" class="icon follow mx-2">
<title>Follow</title>
<use xlink:href="#follow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none unfollow">
<svg viewBox="0 0 24 28" class="icon unfollow mx-2">
<title>Unfollow</title>
<use xlink:href="#unfollow"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none edit">
<svg viewBox="0 0 24 24" class="icon edit mx-2">
<title>Edit</title>
<use xlink:href="#edit"></use>
</svg>
</a>
<a href="javascript:void(0)" class="d-none delete">
<svg viewBox="0 0 24 24" class="icon delete mx-2">
<title>Delete</title>
<use xlink:href="#delete"></use>
</svg>
</a>
</div>
</div>
</div>
</div>
<div class="row message">
<div class="col">
<p>Lorem ipsum dolor sit amet...</p>
</div>
</div>
<div class="d-none blocked2">BLOCKED</div>
</div>
</section>
</div>
</div>
</main>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="edit-symbol" viewBox="0 0 24 24">
<path d="M20.719 7.031l-1.828 1.828-3.75-3.75 1.828-1.828q0.281-0.281 0.703-0.281t0.703 0.281l2.344 2.344q0.281 0.281 0.281 0.703t-0.281 0.703zM3 17.25l11.063-11.063 3.75 3.75-11.063 11.063h-3.75v-3.75z" />
</symbol>
<symbol id="delete-symbol" viewBox="0 0 24 24">
<path d="M18.984 3.984v2.016h-13.969v-2.016h3.469l1.031-0.984h4.969l1.031 0.984h3.469zM6 18.984v-12h12v12q0 0.797-0.609 1.406t-1.406 0.609h-7.969q-0.797 0-1.406-0.609t-0.609-1.406z" />
</symbol>
<symbol id="block-symbol" viewBox="0 0 24 28">
<path d="M20.5 13.953c0-1.703-0.5-3.281-1.359-4.609l-11.781 11.766c1.344 0.875 2.938 1.391 4.641 1.391 4.688 0 8.5-3.828 8.5-8.547zM4.891 18.625l11.797-11.781c-1.344-0.906-2.953-1.422-4.688-1.422-4.688 0-8.5 3.828-8.5 8.531 0 1.734 0.516 3.328 1.391 4.672zM24 13.953c0 6.656-5.375 12.047-12 12.047s-12-5.391-12-12.047c0-6.641 5.375-12.031 12-12.031s12 5.391 12 12.031z"/>
</symbol>
<symbol id="unblock-symbol" viewBox="0 0 24 24">
<path d="M11.859 9h0.141q1.219 0 2.109 0.891t0.891 2.109v0.188zM7.547 9.797q-0.563 1.125-0.563 2.203 0 2.063 1.477 3.539t3.539 1.477q1.078 0 2.203-0.563l-1.547-1.547q-0.375 0.094-0.656 0.094-1.219 0-2.109-0.891t-0.891-2.109q0-0.281 0.094-0.656zM2.016 4.266l1.266-1.266 17.719 17.719-1.266 1.266q-0.234-0.234-1.477-1.453t-1.898-1.875q-2.016 0.844-4.359 0.844-3.703 0-6.703-2.063t-4.313-5.438q0.516-1.219 1.617-2.695t2.133-2.273q-0.563-0.563-1.57-1.594t-1.148-1.172zM12 6.984q-0.938 0-1.828 0.375l-2.156-2.156q1.828-0.703 3.984-0.703 3.703 0 6.68 2.063t4.289 5.438q-1.125 2.766-3.422 4.734l-2.906-2.906q0.375-0.891 0.375-1.828 0-2.063-1.477-3.539t-3.539-1.477z"></path>
</symbol>
<symbol id="follow-symbol" viewBox="0 0 32 28">
<path d="M11 14c-3.313 0-6-2.688-6-6s2.688-6 6-6 6 2.688 6 6-2.688 6-6 6zM26 16h5.5c0.266 0 0.5 0.234 0.5 0.5v3c0 0.266-0.234 0.5-0.5 0.5h-5.5v5.5c0 0.266-0.234 0.5-0.5 0.5h-3c-0.266 0-0.5-0.234-0.5-0.5v-5.5h-5.5c-0.266 0-0.5-0.234-0.5-0.5v-3c0-0.266 0.234-0.5 0.5-0.5h5.5v-5.5c0-0.266 0.234-0.5 0.5-0.5h3c0.266 0 0.5 0.234 0.5 0.5v5.5zM14.5 19.5c0 1.094 0.906 2 2 2h4v3.719c-0.766 0.562-1.734 0.781-2.672 0.781h-13.656c-2.5 0-4.172-1.5-4.172-4.047 0-3.531 0.828-8.953 5.406-8.953 0.25 0 0.422 0.109 0.609 0.266 1.531 1.172 3.016 1.906 4.984 1.906s3.453-0.734 4.984-1.906c0.187-0.156 0.359-0.266 0.609-0.266 1.328 0 2.5 0.5 3.391 1.5h-3.484c-1.094 0-2 0.906-2 2v3z"/>
</symbol>
<symbol id="unfollow-symbol" viewBox="0 0 32 28">
<path d="M11 14c-3.313 0-6-2.688-6-6s2.688-6 6-6 6 2.688 6 6-2.688 6-6 6zM27.828 19l3.891 3.891c0.094 0.094 0.141 0.219 0.141 0.359 0 0.125-0.047 0.25-0.141 0.344l-2.125 2.125c-0.094 0.094-0.219 0.141-0.344 0.141-0.141 0-0.266-0.047-0.359-0.141l-3.891-3.891-3.891 3.891c-0.094 0.094-0.219 0.141-0.359 0.141-0.125 0-0.25-0.047-0.344-0.141l-2.125-2.125c-0.094-0.094-0.141-0.219-0.141-0.344 0-0.141 0.047-0.266 0.141-0.359l3.891-3.891-3.891-3.891c-0.094-0.094-0.141-0.219-0.141-0.359 0-0.125 0.047-0.25 0.141-0.344l2.125-2.125c0.094-0.094 0.219-0.141 0.344-0.141 0.141 0 0.266 0.047 0.359 0.141l3.891 3.891 3.891-3.891c0.094-0.094 0.219-0.141 0.359-0.141 0.125 0 0.25 0.047 0.344 0.141l2.125 2.125c0.094 0.094 0.141 0.219 0.141 0.344 0 0.141-0.047 0.266-0.141 0.359zM20.047 19l-2.828 2.828c-0.375 0.375-0.578 0.891-0.578 1.422 0 0.516 0.203 1.031 0.578 1.406l1.297 1.297c-0.219 0.031-0.453 0.047-0.688 0.047h-13.656c-2.5 0-4.172-1.5-4.172-4.047 0-3.531 0.828-8.953 5.406-8.953 0.25 0 0.422 0.109 0.609 0.266 1.5 1.188 3.031 1.906 4.984 1.906s3.484-0.719 4.984-1.906c0.187-0.156 0.359-0.266 0.609-0.266 0.297 0 0.594 0.031 0.891 0.094-0.516 0.5-0.844 0.906-0.844 1.656 0 0.531 0.203 1.047 0.578 1.422z"/>
</symbol>
</defs>
<g id="edit">
<use xlink:href="#edit-symbol"/>
</g>
<g id="delete">
<use xlink:href="#delete-symbol"/>
</g>
<g id="block">
<use xlink:href="#block-symbol"/>
</g>
<g id="unblock">
<use xlink:href="#unblock-symbol"/>
</g>
<g id="follow">
<use xlink:href="#follow-symbol"/>
</g>
<g id="unfollow">
<use xlink:href="#unfollow-symbol"/>
</g>
</svg>
</body>
</html>
During the loop where I render each entry, if I receive the Response indicating a User is blocked I add the class .blocked to the parent container and flip the displayability of the inner .blocked-overlay by removing Bootstrap's d-none
Then, separately, I attach a simple Event Handler to temporarily reveal the hidden content.

Link inside a TailwindCSS group:focus element fails as click event prevented

I have an FAQ section which has accordion type sprung sections, all made with TailwindCSS (i.e. no Javascript). Links inside open sections do not work (they just close the FAQ as the question looses focus).
Does anyone have any idea how i can get the link event to fire before the focus is lost?
Here's a simple minimal example demonstrating the issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test TailwindCSS Group:Focus</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="tailwind.css" rel="stylesheet">
<style>
/* ----- ACCORDION ----- */
.group:focus .group-focus\:max-h-screen {
max-height: 100vh;
}
.group:focus .group-focus\:text-white {
--text-opacity: 1;
color: #02455a; /*petrol_blue*/
color: rgba(255, 255, 255, var(--text-opacity));
}
.group:focus .group-focus\:-rotate-90 {
--transform-rotate: -90deg;
}
</style>
</head>
<body>
<div class="group" tabindex="1">
<div class="group flex justify-between px-4 py-2 items-center transition cursor-pointer pr-10 relative">
<div class="h-8 w-8 items-center inline-flex justify-center rotate-180 transform transition group-focus:-rotate-90 absolute top-0 left-0 mb-auto ml-auto mt-2 mr-2">
<svg fill="#02455a" height='100px' width='100px' xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 847 847" x="0px" y="0px">
<g><polygon points="670,584 423,263 176,584 "></polygon></g></svg>
</div>
<div class="transition pl-4 hover:opacity-50">Question</div>
</div>
<div class="group-focus:max-h-screen max-h-0 px-4 overflow-hidden">
<p class="pl-4 pr-4 pt-0 pb-2">Answer: Stack Overflow</p>
</div>
</div>
</body>
</html>
tailwind.css is creating using:
npx tailwindcss-cli#latest build -o tailwind.css
(Incidentally, i realise the svg arrow isn't behaving itself, but that's another issue...)
In addition to your group-focus:max-h-screen you could also add focus-within:max-h-screen so that the max-height is kept when the anchor gains focus.
To fix your arrow animation simply replace --transform-rotate with --tw-rotate in your CSS.
.group:focus .group-focus\:max-h-screen {
max-height: 100vh;
}
.group:focus .group-focus\:text-white {
--text-opacity: 1;
color: #02455a;
}
.group:focus .group-focus\:-rotate-90 {
--tw-rotate: 90deg;
}
.focus-within\:max-h-screen:focus-within {
max-height: 100vh;
}
<link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet">
<div class="group" tabindex="1">
<div class="group flex justify-between px-4 py-2 items-center transition cursor-pointer pr-10 relative">
<div class="h-8 w-8 items-center inline-flex justify-center rotate-180 transform transition group-focus:-rotate-90 absolute top-0 left-0 mb-auto ml-auto mt-2 mr-2">
<svg fill="#02455a" height="100px" width="100px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 847 847" x="0px" y="0px">
<g><polygon points="670,584 423,263 176,584 "></polygon></g>
</svg>
</div>
<div class="transition pl-4 hover:opacity-50">Question</div>
</div>
<div class="group-focus:max-h-screen focus-within:max-h-screen max-h-0 px-4 overflow-hidden">
<p class="pl-4 pr-4 pt-0 pb-2">Answer: Stack Overflow</p>
</div>
</div>