custom

'[He] was on 24/7 call, so unplugging the phone wasn't an option': Tech support guy gets revenge on an angry IT customer by programming the office phone to call him at 2, 3, and 4 AM every night

We learned from a young age that you should be nice to the other kids on the playground. Share the bouncy rubber ball, don't pull a girl's pigtails, and include everyone in your fun games! That's how it should be in the working world–the adult world–because if you make an enemy on the blacktop, you might just get destroyed in the next game of dodgeball. 

This IT customer learned never to mess with their tech support crew after being a total buffoon on the phone. He was known for screaming at the guys who were just trying to help him troubleshoot his modem, but finally, after being placed with the same phone support guy one too many times, he snapped and decided to get some revenge. 

Frankly, I think this guy's sleep schedule became a little more precious to him after he got completely pwned by the dude he was used to screaming at–I guess now it looks like the phone is the only thing screaming at 2 AM… 3 AM… and 4 AM. Do you think he'll be nicer to his next customer service rep after this? You be the judge.




custom

‘I got extra pay, a box of chocolates, [and] an apology': Karen gets fired after screaming for 40 minutes at a customer service rep because they refuse to break company policy

Is it really so difficult to be kind to the customer service person trying to troubleshoot your problem over the phone? I get it, everything's falling to pieces on your end, but it doesn't make any logical sense to be unsavory to the one person who can actually help you.  

This Karen in our next story proved that being aggressive over the phone doesn't get you everything you want, and sometimes it can get you fired…. Or maybe even investigated by the Feds. 

Imagine, this customer service employee was about 15 seconds from clocking out for the day–it was Friday at 4:59:45 PM and they were grabbing their coats on their way out and the blasted phone rang. Seeing that the number was from an internal caller, as in, someone within their company, the employee thought this would be a simple thing to solve and that they could make quick work of their coworker's problem. Except, the woman on the other end of the line wasn't looking for solutions, she was looking for a customer service rep to break the rules for her. 

Keep scrolling to see how a 40-minute IT support call turned into an apology letter, a box of chocolates, and an immediate, dishonorable resignation. 




custom

Tax-News.com: Switzerland To Draft New Customs Tax Act

On September 11, 2020, the Swiss Federal Council launched a consultation on proposals for the total revision of the customs system.




custom

Mapping Genetic Mutations to Customize Preterm Birth Therapy

medlinkPregnant women/medlink with high levels of certain genetic mutations- especially those associated with involuntary muscle contraction - were less likely to respond to preterm treatment.




custom

Future of Cancer Treatment Lays With Custom Vaccines

Comprehensive computational pipeline that integrates molecular and genetic analyses of tumors, along with T-cell targets, to design personalized cancer




custom

Employees First, Customers Second

One small idea can ignite a revolution just as a single matchstick can start a fire. One such idea - putting employees first and customers second -...




custom

Places with Eye-popping Customs of Drinking and Eating Habits

Each place has its own distinct feature of eating habits. As there are diversities in races so are the differences in food habits. So, below mentioned are some places with eye-popping customs of drinking or eating habits




custom

Halloween custom ideas

I had to say time flies, it is Halloween again. It seems it is not long from the Halloween’s day of 2012. Today is just the Halloween of 2013. Have you prepared for it? If you still do not have any idea about the...




custom

Custom applications bringing changes in online business

In yester years, only the business organizations with huge financial backing were able to initiate the process of custom software development. This condition immediately changed when positive remarks on the usage of these applications...





custom

Livestream platform Mandolin adds custom artist pages and a fan data analytics hub

Mandolin, the digital fan engagement platform, launched two new products today with the aim of assisting artists with turning fans into superfans and maximizing revenue. Fan Navigator helps artists collect fan data and teaches them how to engage fans with digital experiences. Mandolin’s Fan Pages also drive fan engagement with a page for the artist […]

© 2024 TechCrunch. All rights reserved. For personal use only.




custom

Sabith vs Additional Commissioner Of Customs on 8 November, 2024

[WP(C) Nos.26883/2024, 38022/2024, 38213/2024, 38235/2024 & 38427/2024] The issue raised in these writ petitions are covered against the petitioners by the judgment of the Supreme Court in Chandra Sekhar Jha v. Union of India and others; (2022) 14 SCC 152. It is clear from a reading of the judgment of the Supreme Court that after the amendment of Section 129 E of Customs Act, 1962 with effect from 06-08-2014 it is a provision beneficial to the persons who propose to file an appeal (like the petitioners herein) and only requires deposit of a portion of the demand. On a consideration of the provision is substituted with effect from 06-08-2024 and on considering the question as to whether such provision will cause undue hardship, it was held as follows;




custom

Najeeb Rahman vs Additional Commissioner Of Customs on 8 November, 2024

[WP(C) Nos.26883/2024, 38022/2024, 38213/2024, 38235/2024 & 38427/2024] The issue raised in these writ petitions are covered against the petitioners by the judgment of the Supreme Court in Chandra Sekhar Jha v. Union of India and others; (2022) 14 SCC 152. It is clear from a reading of the judgment of the Supreme Court that after the amendment of Section 129 E of Customs Act, 1962 with effect from 06-08-2014 it is a provision beneficial to the persons who propose to file an appeal (like the petitioners herein) and only requires deposit of a portion of the demand. On a consideration of the provision is substituted with effect from 06-08-2024 and on considering the question as to whether such provision will cause undue hardship, it was held as follows;




custom

Mohammed Valappil vs Additional Commissioner Of Customs on 8 November, 2024

[WP(C) Nos.26883/2024, 38022/2024, 38213/2024, 38235/2024 & 38427/2024] The issue raised in these writ petitions are covered against the petitioners by the judgment of the Supreme Court in Chandra Sekhar Jha v. Union of India and others; (2022) 14 SCC 152. It is clear from a reading of the judgment of the Supreme Court that after the amendment of Section 129 E of Customs Act, 1962 with effect from 06-08-2014 it is a provision beneficial to the persons who propose to file an appeal (like the petitioners herein) and only requires deposit of a portion of the demand. On a consideration of the provision is substituted with effect from 06-08-2024 and on considering the question as to whether such provision will cause undue hardship, it was held as follows;




custom

Sony PS5 Chroma Collection Accessories and Custom Fortnite DualSense Controller Launched in India

Sony has introduced the Chroma Collection accessories and a Fortnite Limited Edition DualSense wireless controller for PlayStation 5 users in India. These new offerings provide stylish customisation options with unique colours and designs, enhancing the gaming experience. The Chroma Collection features




custom

Maximise Efficiency with Voice Assistants: Customisation and Integration Techniques

In today's fast-paced world, voice assistants have become indispensable tools for tech enthusiasts. These digital aides can streamline tasks, manage schedules, and control smart devices with simple voice commands. However, to harness their full potential, setting up and customising your voice




custom

Flipkart Faces Growing Customer Frustration Over Order Cancellations Before Big Billion Days Sale

As Flipkart gears up for its annual Big Billion Days sale, the company is facing an unexpected wave of controversy. Just days before the sale’s scheduled start on September 27th, customers have taken to social media platforms like X (formerly Twitter)




custom

How Customization In Elevators Can Make The Look Aesthetically Pleasing

Elevator rides are often perceived as mundane and uneventful. However, customization has the power to transform these moments into memorable experiences.




custom

How Premature AI Adoption Can Lead To Customer Frustration, Explains Ravi Kumar Of Cubastion Consulting

Before embracing AI, it's essential for companies to have a solid foundation in their traditional technology infrastructure. 




custom

3 Things Telecom Firms Should Be Doing For Improving Customer Service



  • Thomas K Thomas

custom

Bombay HC restricts Customs Dept. from destroying artworks by famous artists F. N. Souza and Akbar Padamsee

The artworks were seized in 2023 over allegations of obscenity




custom

Bombay High Court orders Customs Dept. to release artworks of Francis Newton Souza and Akbar Padamsee in next two weeks  

The High Court pulled up the Customs Department of Mumbai and said that every nude painting or every painting depicting some sexual intercourse poses cannot be styled as obscene




custom

Customers no longer reluctant to adopt AI, says Hitachi Vantara’s Hemant Tiwari

Even non-tech companies have AI requirements. If you’re manufacturing a transformer, a train engine, or a jet engine, AI goes into making them efficient: Tiwari




custom

Getting Started with CSS Shapes: Wrapping content around custom paths

Using CSS Shapes we can create experiences that we have never been able to create on the web before.




custom

‘The challenge was in getting the aircraft’s custom clearance’

Private jet operator JetSetGo’s CEO Kanika Tekriwal describes the intricacies of directly importing and leasing an aircraft




custom

Customer management




custom

The customer is king. Really?

If service is core, why outsource it?




custom

How integrating services with hardware helped Lenovo address its customers’ critical needs

Shailendra Katyal, Managing Director, Lenovo India, on the company’s services-led transformation



  • Computers & Laptops

custom

Creating an in-store experience for the customer | WIRED Smarter

Before co-founding SHOWFIELDS, The Most Interesting Store in The World, Hunt began her career as the third employee of Warby Parker, and served as Chief Brand Officer for Hinge. Join Hunt at WIRED Smarter as she discusses the importance of creating an in-store experience for her customers. ABOUT WIRED SMARTER Curated by WIRED’s award-winning editorial team, WIRED Smarter gathers the disruptive minds across business, technology, retail, finance and politics to investigate how innovation, technological advances and world events are changing the way we interact with customers.




custom

Energizing customers for a carbon free America | WIRED Brand Lab

Produced by WIRED Brand Lab with EY | How can energy companies leverage data to empower consumers to reduce their consumption? Brett C. Carter, EVP and Chief Customer and Innovation Officer at Xcel Energy and Sam R. Johnson, EY Americas Vice Chair of Accounts help us understand how two-way communication between customers and energy providers enable individuals to use energy when renewable sources are at their peak and charge an electric vehicle when costs are at their lowest.




custom

Obsessed - How This Guy Invents Crazy Skateboards For Custom Tricks

Inventing a skateboard trick is difficult enough but Matt Tomasello takes things a step further, creating custom boards that are part of the tricks themselves. Get to know the professional skateboarder (and amateur engineer) who’s reinventing the sport with his own wholly unique approach. Special thanks: Fancy Lad Skateboards




custom

Legit Customer Reviews of Talkliv

Articles What it could be like as being a foreign female in China and tiawan Humorous approaches to express like The profiles are all genuine with real Chinese photos and never any of those retouched https://top10chinesedatingsites.net/jiayuan-review/ photos. Many Chinese singles here are also fluent in their English speaking and writing abilities which makes it convenient […]




custom

Two options for using custom properties

Recently I interviewed Stefan Judis for my upcoming book. We discussed CSS custom properties, and something interesting happened.

We had a period of a few minutes where we were talking past one another, because, as it turns out, we have completely opposite ideas about the use of CSS custom properties. I had never considered his approach, and I found it interesting enough to write this quick post.

Option 1

Take several site components, each with their own link and hover/focus colours. We want to use custom properties for those colours. Exactly how do we do that?

Before my discussion with Stefan that wasn’t even a question for me. I would do this:

.component1 {
	--linkcolor: red;
	--hovercolor: blue;
}

.component2 {
	--linkcolor: purple;
	--hovercolor: cyan;
}

a {
	color: var(--linkcolor);
}

a:hover,a:focus {
	color: var(--hovercolor)
}

I set the normal and hover/focus colour as a custom property, and leave the definition of those properties to the component the link appears in. The first and second component each define different colours, which are deployed in the correct syntax. Everything works and all’s well with the world.

As far as I can see now this is the default way of using CSS custom properties. I wasn’t even aware that another possibility existed.

Option 2

Stefan surprised me by doing almost the complete opposite. He uses only a single variable and changes its value where necessary:

.component1 {
	--componentcolor: red;
}

.component1 :is(a:hover,a:focus) {
	--componentcolor: blue;
}
	
.component2 {
	--componentcolor: purple;
}

.component2 :is(a:hover,a:focus) {
	--componentcolor: cyan;
}
	
a {
	color: var(--componentcolor)		
}

At first I was confused. Why would you do this? What’s the added value of the custom property? Couldn’t you just have entered the colour values in the component styles without using custom properties at all?

Well, yes, you could. But that’s not Stefan’s point.

The point

In practice, component definitions have way more styles than just colours. There’s a bunch of box-model properties, maybe a display, and possibly text styling instructions. In any case, a lot of lines of CSS.

If you use custom properties only for those CSS properties that will change you give future CSS developers a much better and quicker insight in how your component works. If the definition uses a custom property that means the property may change in some circumstances. If it uses a fixed definition you know it’s a constant.

Suppose you encounter this component definition in a codebase you just inherited:

.component {
	--color: red;
	--background: blue
	--layout: flex;
	--padding: 1em;
	--borderWidth: 0.3em;
	display: var(--layout);
	color: var(--color);
	background: var(--background);
	padding: var(--padding);
	border: var(--borderWidth) solid black;
	margin: 10px;
	border-radius: 2em;
	grid-template-columns: repeat(3,1fr);
	flex-wrap: wrap;
}

Now you essentially found a definition file. Not only do you see the component’s default styles, you also see what might change and what will not. For instance, because the margin and border-radius are hard-coded you know they are never changed. In the case of the border, only the width changes, not the style or the colour. Most other properties can change.

The use of display: var(--layout) is particularly revealing. Apparently something somewhere changes the component’s layout from grid to flexbox. Also, if it’s a grid it has three equal columns, while if it’s a flexbox it allows wrapping. This suggests that the flexbox layout is used on narrower screens, switching to a grid layout on wider screens.

Where does the flexbox change to a grid? As a newbie to this codebase you don’t know, but you can simply search for --layout: grid and you’ll find it, probably neatly tucked away in a media query somewhere. Maybe there is a basic layout as well, which uses neither flexbox nor grid? Search for --layout: block and you’ll know.

Thus, this way of using custom properties is excellently suited for making readable code bases that you can turn over to other CSS developers. They immediately know what changes and what doesn’t.

Teaching aid?

There’s another potential benefit as well: this way of using custom properties, which are essentially variables, aligns much more with JavaScript’s use of variables. You set an important variable at the start of your code, and change it later on if necessary. This is what you do in JavaScript all the time.

Thus this option may be better suited to teaching CSS to JavaScripters, which remains one of my preoccupations due to the upcoming book.

Picking an option

Which option should you pick? That’s partly a matter of personal preference. Since the second option is still fairly new to me, and I rarely work on large projects, I am still feeling my way around it. Right at this moment I prefer the first way because I’m used to it. But that might change, given some extra time.

Still, I think Stefan is on to something. I think that his option is very useful in large codebases that can be inherited by other developers. I think it deserves careful consideration.



  • CSS for JavaScripters

custom

Custom properties and @property

You’re reading a failed article. I hoped to write about @property and how it is useful for extending CSS inheritance considerably in many different circumstances. Alas, I failed. @property turns out to be very useful for font sizes, but does not even approach the general applicability I hoped for.

Grandparent-inheriting

It all started when I commented on what I thought was an interesting but theoretical idea by Lea Verou: what if elements could inherit the font size of not their parent, but their grandparent? Something like this:

div.grandparent {
	/* font-size could be anything */
}

div.parent {
	font-size: 0.4em;
}

div.child {
	font-size: [inherit from grandparent in some sort of way];
	font-size: [yes, you could do 2.5em to restore the grandparent's font size];
	font-size: [but that's not inheriting, it's just reversing a calculation];
	font-size: [and it will not work if the parent's font size is also unknown];
}

Lea told me this wasn’t a vague idea, but something that can be done right now. I was quite surprised — and I assume many of my readers are as well — and asked for more information. So she wrote Inherit ancestor font-size, for fun and profit, where she explained how the new Houdini @property can be used to do this.

This was seriously cool. Also, I picked up a few interesting bits about how CSS custom properties and Houdini @property work. I decided to explain these tricky bits in simple terms — mostly because I know that by writing an explanation I myself will understand them better — and to suggest other possibilities for using Lea’s idea.

Alas, that last objective is where I failed. Lea’s idea can only be used for font sizes. That’s an important use case, but I had hoped for more. The reasons why it doesn’t work elsewhere are instructive, though.

Tokens and values

Let’s consider CSS custom properties. What if we store the grandparent’s font size in a custom property and use that in the child?

div.grandparent {
	/* font-size could be anything */
	--myFontSize: 1em;
}

div.parent {
	font-size: 0.4em;
}

div.child {
	font-size: var(--myFontSize);
	/* hey, that's the grandparent's font size, isn't it? */
}

This does not work. The child will have the same font size as the parent, and ignore the grandparent. In order to understand why we need to understand how custom properties work. What does this line of CSS do?

--myFontSize: 1em;

It sets a custom property that we can use later. Well duh.

Sure. But what value does this custom property have?

... errr ... 1em?

Nope. The answer is: none. That’s why the code example doesn’t work.

When they are defined, custom properties do not have a value or a type. All that you ordered the browsers to do is to store a token in the variable --myFontSize.

This took me a while to wrap my head around, so let’s go a bit deeper. What is a token? Let’s briefly switch to JavaScript to explain.

let myVar = 10;

What’s the value of myVar in this line? I do not mean: what value is stored in the variable myVar, but: what value does the character sequence myVar have in that line of code? And what type?

Well, none. Duh. It’s not a variable or value, it’s just a token that the JavaScript engine interprets as “allow me to access and change a specific variable” whenever you type it.

CSS custom properties also hold such tokens. They do not have any intrinsic meaning. Instead, they acquire meaning when they are interpreted by the CSS engine in a certain context, just as the myVar token is in the JavaScript example.

So the CSS custom property contains the token 1em without any value, without any type, without any meaning — as yet.

You can use pretty any bunch of characters in a custom property definition. Browsers make no assumptions about their validity or usefulness because they don’t yet know what you want to do with the token. So this, too, is a perfectly fine CSS custom property:

--myEgoTrip: ppk;

Browsers shrug, create the custom property, and store the indicated token. The fact that ppk is invalid in all CSS contexts is irrelevant: we haven’t tried to use it yet.

It’s when you actually use the custom property that values and types are assigned. So let’s use it:

background-color: var(--myEgoTrip);

Now the CSS parser takes the tokens we defined earlier and replaces the custom property with them:

background-color: ppk;

And only NOW the tokens are read and intrepreted. In this case that results in an error: ppk is not a valid value for background-color. So the CSS declaration as a whole is invalid and nothing happens — well, technically it gets the unset value, but the net result is the same. The custom property itself is still perfectly valid, though.

The same happens in our original code example:

div.grandparent {
	/* font-size could be anything */
	--myFontSize: 1em; /* just a token; no value, no meaning */
}

div.parent {
	font-size: 0.4em;
}

div.child {
	font-size: var(--myFontSize);
	/* becomes */
	font-size: 1em; 
	/* hey, this is valid CSS! */
	/* Right, you obviously want the font size to be the same as the parent's */
	/* Sure thing, here you go */
}

In div.child he tokens are read and interpreted by the CSS parser. This results in a declaration font-size: 1em;. This is perfectly valid CSS, and the browsers duly note that the font size of this element should be 1em.

font-size: 1em is relative. To what? Well, to the parent’s font size, of course. Duh. That’s how CSS font-size works.

So now the font size of the child becomes the same as its parent’s, and browsers will proudly display the child element’s text in the same font size as the parent element’s while ignoring the grandparent.

This is not what we wanted to achieve, though. We want the grandparent’s font size. Custom properties — by themselves — don’t do what we want. We have to find another solution.

@property

Lea’s article explains that other solution. We have to use the Houdini @property rule.

@property --myFontSize {
	syntax: "<length>";
	initial-value: 0;
	inherits: true;
}

div {
	border: 1px solid;
	padding: 1em;
}

div.grandparent {
	/* font-size could be anything */
	--myFontSize: 1em;
}

div.parent {
	font-size: 0.4em;
}

div.child {
	font-size: var(--myFontSize);
}

Now it works. Wut? Yep — though only in Chrome so far.

This is the grandparent
This is the parent
This is the child

What black magic is this?

Adding the @property rule changes the custom property --myFontSize from a bunch of tokens without meaning to an actual value. Moreover, this value is calculated in the context it is defined in — the grandfather — so that the 1em value now means 100% of the font size of the grandfather. When we use it in the child it still has this value, and therefore the child gets the same font size as the grandfather, which is exactly what we want to achieve.

(The variable uses a value from the context it’s defined in, and not the context it’s executed in. If, like me, you have a grounding in basic JavaScript you may hear “closures!” in the back of your mind. While they are not the same, and you shouldn’t take this apparent equivalency too far, this notion still helped me understand. Maybe it’ll help you as well.)

Unfortunately I do not quite understand what I’m doing here, though I can assure you the code snippet works in Chrome — and will likely work in the other browsers once they support @property.

Misson completed — just don’t ask me how.

Syntax

You have to get the definition right. You need all three lines in the @property rule. See also the specification and the MDN page.

@property --myFontSize {
	syntax: "<length>";
	initial-value: 0;
	inherits: true;
}

The syntax property tells browsers what kind of property it is and makes parsing it easier. Here is the list of possible values for syntax, and in 99% of the cases one of these values is what you need.

You could also create your own syntax, e.g.

syntax: "ppk | <length>"

Now the ppk keyword and any sort of length is allowed as a value.

Note that percentages are not lengths — one of the many things I found out during the writing of this article. Still, they are so common that a special value for “length that may be a percentage or may be calculated using percentages” was created:

syntax: "<length-percentage>"

Finally, one special case you need to know about is this one:

syntax: "*"

MDN calls this a universal selector, but it isn’t, really. Instead, it means “I don’t know what syntax we’re going to use” and it tells browsers not to attempt to interpret the custom property. In our case that would be counterproductive: we definitely want the 1em to be interpreted. So our example doesn’t work with syntax: "*".

initial-value and inherits

An initial-value property is required for any syntax value that is not a *. Here that’s simple: just give it an initial value of 0 — or 16px, or any absolute value. The value doesn’t really matter since we’re going to overrule it anyway. Still, a relative value such as 1em is not allowed: browsers don’t know what the 1em would be relative to and reject it as an initial value.

Finally, inherits: true specifies that the custom property value can be inherited. We definitely want the computed 1em value to be inherited by the child — that’s the entire point of this experiment. So we carefully set this flag to true.

Other use cases

So far this article merely rehashed parts of Lea’s. Since I’m not in the habit of rehashing other people’s articles my original plan was to add at least one other use case. Alas, I failed, though Lea was kind enough to explain why each of my ideas fails.

Percentage of what?

Could we grandfather-inherit percentual margins and paddings? They are relative to the width of the parent of the element you define them on, and I was wondering if it might be useful to send the grandparent’s margin on to the child just like the font size. Something like this:

@property --myMargin {
	syntax: "<length-percentage>";
	initial-value: 0;
	inherits: true;
}

div.grandparent {
	--myMargin: 25%;
	margin-left: var(--myMargin);
}

div.parent {
	font-size: 0.4em;
}

div.child {
	margin-left: var(--myMargin);
	/* should now be 25% of the width of the grandfather's parent */
	/* but isn't */
}

Alas, this does not work. Browsers cannot resolve the 25% in the context of the grandparent, as they did with the 1em, because they don’t know what to do.

The most important trick for using percentages in CSS is to always ask yourself: “percentage of WHAT?”

That’s exactly what browsers do when they encounter this @property definition. 25% of what? The parent’s font size? Or the parent’s width? (This is the correct answer, but browsers have no way of knowing that.) Or maybe the width of the element itself, for use in background-position?

Since browsers cannot figure out what the percentage is relative to they do nothing: the custom property gets the initial value of 0 and the grandfather-inheritance fails.

Colours

Another idea I had was using this trick for the grandfather’s text colour. What if we store currentColor, which always has the value of the element’s text colour, and send it on to the grandchild? Something like this:

@property --myColor {
	syntax: "<color>";
	initial-value: black;
	inherits: true;
}

div.grandparent {
	/* color unknown */
	--myColor: currentColor;
}

div.parent {
	color: red;
}

div.child {
	color: var(--myColor);
	/* should now have the same color as the grandfather */
	/* but doesn't */
}

Alas, this does not work either. When the @property blocks are evaluated, and 1em is calculated, currentColor specifically is not touched because it is used as an initial (default) value for some inherited SVG and CSS properties such as fill. Unfortunately I do not fully understand what’s going on, but Tab says this behaviour is necessary, so it is.

Pity, but such is life. Especially when you’re working with new CSS functionalities.

Conclusion

So I tried to find more possbilities for using Lea’s trick, but failed. Relative units are fairly sparse, especially when you leave percentages out of the equation. em and related units such as rem are the only ones, as far as I can see.

So we’re left with a very useful trick for font sizes. You should use it when you need it (bearing in mind that right now it’s only supported in Chromium-based browsers), but extending it to other declarations is not possible at the moment.

Many thanks to Lea Verou and Tab Atkins for reviewing and correcting an earlier draft of this article.



  • CSS for JavaScripters

custom

Customise your new home

You can build-to-order your dream home and continue to enjoy the benefits of community living




custom

Bank ordered to pay ₹1 lakh to customer for failing to return loan documents




custom

Reflections on America’s customary face-off

The long tradition of American Presidential debates has meant make or break for Presidents and presidential aspirants




custom

Price Customization and Targeting in Matching Markets [electronic journal].




custom

How Britain Unified Germany: Endogenous Trade Costs and the Formation of a Customs Union [electronic journal].




custom

Enhancing the separation of C2H4/C2H6 in customized MOR zeolites

Inorg. Chem. Front., 2024, 11,2427-2435
DOI: 10.1039/D4QI00236A, Research Article
Hongwei Chen, Binyu Wang, Bin Zhang, Yongheng Ren, Jiuhong Chen, Jiabao Gui, Xiufeng Shi, Wenfu Yan, Jinping Li, Libo Li
MOR zeolites synthesized with cost-effective, non-toxic materials enhance ethylene separation without Ag or Cu modification. The customized framework composition improves adsorptive properties economically.
The content of this RSS Feed (c) The Royal Society of Chemistry




custom

Indian rice exports get delayed at ports as Customs officials hold up consignments

Exporters say they incur $70/tonne additional costs; Customs officials playing safe to verify if shipments are white or parboiled rice




custom

Kandla Customs Commissioner orders release of ship detained in organic rice export irregularities

Tells Kandla traffic manager to allow another ship to set sail after getting release order from Gujarat HC




custom

CCL Products says more customers prefer short-term coffee contracts as market stays volatile

See some softening in Vietnam prices as new arrivals are set to begin next month




custom

Faced with revenue headwinds, airlines go extra mile to win customers

These initiatives come amid increased capacity and intensified competition in the Indian skies




custom

BSNL customer service changing for the better




custom

578: Customer Support, P3 Color, Dave on Productivity, and Mobile vs Desktop

Is Apple's Numbers amazing or the worst? Customer support at various levels of software, Figma and P3 color, imagining a colorspace property in CSS, what's Dave doing for productivity, how has offloading CSS Tricks affected Chris, and should we build different websites for mobile vs desktop?




custom

Aggregated customer power

User-friendly financial services are a click away with account aggregators




custom

Making a Better Custom Select Element

Julie Grundy kicks off this, our fifteenth year, by diving headlong into the snowy issue of customising form inputs. Nothing makes a more special gift at Christmas that something you’ve designed and customised yourself. But can it be done while staying accessible to every user?


In my work as an accessibility consultant, there are some frequent problems I find on people’s websites. One that’s come up a lot recently is that people are making custom select inputs for their forms. I can tell that people are trying to make them accessible, because they’ve added ARIA attributes or visually-hidden instructions for screen reader users. Sometimes they use a plugin which claims to be accessible. And this is great, I love that folks want to do the right thing! But so far I’ve never come across a custom select input which actually meets all of the WCAG AA criteria.

Often I recommend to people that they use the native HTML select element instead. Yes, they’re super ugly, but as Scott Jehl shows us in his article Styling a Select Like It’s 2019 they are a lot easier to style than they used to be. They come with a lot of accessibility for free – they’re recognised and announced clearly by all screen reader software, they work reliably and predictably with keyboards and touch, and they look good in high contrast themes.

But sometimes, I can’t recommend the select input as a replacement. We want a way for someone to choose an item from a list of options, but it’s more complicated than just that. We want autocomplete options. We want to put images in there, not just text. The optgroup element is ugly, hard to style, and not announced by screen readers. The focus styles are low contrast. I had high hopes for the datalist element, but although it works well with screen readers, it’s no good for people with low vision who zoom or use high contrast themes.

Figure 1: a datalist zoomed in by 300%

Select inputs are limited in a lot of ways. They’re frustrating to work with when you have something which looks almost like what you want, but is too restricted to be useful. We know we can do better, so we make our own.

Let’s work out how to do that while keeping all the accessibility features of the original.

Semantic HTML

We’ll start with a solid, semantic HTML base. A select input is essentially a text input which restricts the possible answers, so let’s make a standard input.

<label for="custom-select">User Type</label>
<input type="text" id="custom-select">

Then we need to show everyone who can see that there are options available, so let’s add an image with an arrow, like the native element.

<label for="custom-select">User Type</label>
<input type="text" id="custom-select">
<img src="arrow-down.svg" alt="">

For this input, we’re going to use ARIA attributes to represent the information in the icon, so we’ll give it an empty alt attribute so screen readers don’t announce its filename.

Finally, we want a list of options. An unordered list element is a sensible choice here. It also lets screen reader software understand that these bits of text are related to each other as part of a group.

<ul class="custom-select-options">
  <li>User</li>
  <li>Author</li>
  <li>Editor</li>
  <li>Manager</li>
  <li>Administrator</li>
</ul>

You can dynamically add or remove options from this list whenever you need to. And, unlike our <option> element inside a <select>, we can add whatever we like inside the list item. So if you need images to distinguish between lots of very similar-named objects, or to add supplementary details, you can go right ahead. I’m going to add some extra text to mine, to help explain the differences between the choices.

This is a good base to begin with. But it looks nothing like a select input! We want to make sure our sighted users get something they’re familiar with and know how to use already.

Styling with CSS

I’ll add some basic styles similar to what’s in Scott Jehl’s article above.

We also need to make sure that people who customise their colours in high contrast modes can still tell what they’re looking at. After checking it in the default Windows high contrast theme, I’ve decided to add a left-hand border to the focus and hover styles, to make sure it’s clear which item is about to be chosen.

This would be a good time to add any dark-mode styles if that’s your jam. People who get migraines from bright screens will thank you!

JavaScript for behaviour

Of course, our custom select doesn’t actually do anything yet. We have a few tasks for it: to toggle the options list open and closed when we click the input, to filter the options when people type in the input, and for selecting an option to add it to the input and close the list. I’m going to tackle toggling first because it’s the easiest.

Toggling

Sometimes folks use opacity or height to hide content on screen, but that’s like using Harry Potter’s invisibility cloak. No-one can see what’s under there, but Harry doesn’t cease to exist and you can still poke him with a wand. In our case, screen reader and keyboard users can still reach an invisible list.

Instead of making the content see-through or smaller, I’m going to use display: none to hide the list. display: none removes the content from the accessibility tree, so it can’t be accessed by any user, not just people who can see. I always have a pair of utility classes for hiding things, as follows:

.hidden-all {
  display: none;
}

.hidden-visually {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    -webkit-clip-path: inset(50%);
    clip-path: inset(50%);
    border: 0;
} 

So now I can just toggle the CSS class .hidden-all on my list whenever I like.

Browsing the options

Opening up our list works well for our mouse and touch-screen users. Our styles give a nice big tap target for touch, and mouse users can click wherever they like.

We need to make sure our keyboard users are taken care of though. Some of our sighted users will be relying on the keyboard if they have mobility or dexterity issues. Usually our screen reader users are in Browse mode, which lets them click the arrow keys to navigate through content. However, custom selects are usually inside form elements. which pushes screen reader software to Forms Mode. In Forms mode, the screen reader software can only reach focusable items when the user clicks the Tab key, unless we provide an alternative. Our list items are not focusable by default, so let’s work on that alternative.

To do this, I’m adding a tabindex of -1 to each list item. This way I can send focus to them with JavaScript, but they won’t be part of the normal keyboard focus path of the page.

csOptions.forEach(function(option) {
    option.setAttribute('tabindex, '-1')
}) 

Now I can move the focus using the Up and Down arrow keys, as well as with a mouse or tapping the screen. The activeElement property of the document is a way of finding where the keyboard focus is at the moment. I can use that to loop through the elements in the list and move the focus point forward or back, depending on which key is pressed.

function doKeyAction(whichKey) {
  const focusPoint = document.activeElement
  switch(whichKey) {
    case: 'ArrowDown':
      toggleList('Open')
      moveFocus(focusPoint, 'forward')
      break
    case: 'ArrowUp':
      toggleList('Open')
      moveFocus(focusPoint, 'back')
      break
  }
}

Selecting

The Enter key is traditional for activating an element, and we want to match the original select input.

We add another case to the keypress detector…

case 'Enter':
  makeChoice(focusPoint)
  toggleList('Shut')
  setState('closed')
  break 

… then make a function which grabs the currently focused item and puts it in our text input. Then we can close the list and move focus up to the input as well.

function makeChoice(whichOption) {
    const optionText = whichOption.documentQuerySelector('strong')
    csInput.value = optionText
}

Filtering

Standard select inputs have keyboard shortcuts – typing a letter will send focus to the first item in the option which begins with that letter. If you type the letter again, focus will move to the next option beginning with that letter.

This is useful, but there’s no clue to tell users how many options might be in this category, so they have to experiment to find out. We can make an improvement for our users by filtering to just the set of options which matches that letter or sequence of letters. Then sighted users can see exactly how many options they’ve got, and continue filtering by typing more if they like. (Our screen reader users can’t see the remaining options while they’re typing, but don’t worry – we’ll have a solution for them in the next section).

I’m going to use the .filter method to make a new array which only has the items which match the text value of the input. There are different ways you could do this part – my goal was to avoid having to use regex, but you should choose whatever method works best for your content.

function doFilter() {
  const terms = csInput.value
  const aFilteredOptions = aOptions.filter(option => {
    if (option.innerText.toUpperCase().startsWith(terms.toUpperCase())) {
    return true
    }
  })
  // hide all options
  csOptions.forEach(option => option.style.display = "none")
  // re-show the options which match our terms
  aFilteredOptions.forEach(function(option) {
    option.style.display = ""
  })
} 

Nice! This is now looking and behaving really well. We’ve got one more problem though – for a screen reader user, this is a jumble of information. What’s being reported to the browser’s accessibility API is that there’s an input followed by some clickable text. Are they related? Who knows! What happens if we start typing, or click one of the clicky text things? It’s a mystery when you can’t see what’s happening. But we can fix that.

ARIA

ARIA attributes don’t provide much in the way of additional features. Adding an aria-expanded='true' attribute doesn’t actually make anything expand. What ARIA does is provide information about what’s happening to the accessibility API, which can then pass it on to any assistive technology which asks for it.

The WCAG requirements tell us that when we’re making custom elements, we need to make sure that as a whole, the widget tells us its name, its role, and its current value. Both Chrome and Firefox reveal the accessibility tree in their dev tools, so you can check how any of your widgets will be reported.

We already have a name for our input – it comes from the label we associated to the text input right at the start. We don’t need to name every other part of the field, as that makes it seem like more than one input is present. We also don’t need to add a value, because when we select an item from the list, it’s added to the text input and therefore is exposed to the API.

Figure 2: How Firefox reports our custom select to assistive technology.

But our screen readers are going to announce this custom select widget as a text entry field, with some images and a list nearby.

The ARIA Authoring Practices site has a pattern for comboboxes with listboxes attached. It tells you all the ARIA you need to make screen reader software give a useful description of our custom widget.

I’m going to add all this ARIA via JavaScript, instead of putting it in the HTML. If my JavaScript doesn’t work for any reason, the input can still be a plain text field, and we don’t want screen readers to announce it as anything fancier than that.

csSelector.setAttribute('role', 'combobox') 
csSelector.setAttribute('aria-haspopup', 'listbox')
csSelector.setAttribute('aria-owns', '#list') 
csInput.setAttribute('aria-autocomplete', 'both')
csInput.setAttribute('aria-controls', 'list')

The next thing to do is let blind users know if the list is opened or closed. For that task I’m going to add an aria-expanded attribute to the group, and update it from false to true whenever the list changes state in our toggling function.

The final touch is to add a secret status message to the widget. We can use it to update the number of options available after we’ve filtered them by typing into the input. When there are a lot of options to choose from, this helps people who can’t see the list reducing know if they’re on the right track or not.

To do that we first have to give the status message a home in our HTML.

<div id='custom-select-status' class='hidden-visually' aria-live='polite'></div>

I’m using our visually-hidden style so that only screen readers will find it. I’m using aria-live so that it will be announced as often as it updates, not just when a screen reader user navigates past it. Live regions need to be present at page load, but we won’t have anything to say about the custom select then so we can leave it empty for now.

Next we add one line to our filtering function, to find the length of our current list.

updateStatus(aFilteredOptions.length)

Then we send that to a function which will update our live region.

function updateStatus(howMany) {
    console.log('updating status')
    csStatus.textContent = howMany + " options available."
}

Conclusion

Let’s review what we’ve done to make an awesome custom select input:

  • Used semantic HTML so that it’s easily interpreted by assistive technology while expanding the types of content we can include in it
  • Added CSS styles which are robust enough to survive different visual environments while also fitting into our branding needs
  • Used JavaScript to provide the basic functionality that the native element has
  • Added more JavaScript to get useful functionality that the native element lacks
  • Carefully added ARIA attributes to make sure that the purpose and results of using the element are available to assistive technology and are updated as the user interacts with it.

You can check out my custom select pattern on GitHub – I’ll be making additions as I test it on more assistive technology, and I welcome suggestions for improvements.

The ARIA pattern linked above has a variety of examples and customisations. I hope stepping through this example shows you why each of the requirements exists, and how you can make them fit your own needs.

I think the volume of custom select inputs out there shows the ways in which the native select input is insufficient for modern websites. You’ll be pleased to know that Greg Whitworth and Simon Pieters are working on improving several input types! You can let them know what features you’d like selects to have. But until that work pays off, let’s make our custom selects as accessible and robust as they can possibly be.


About the author

Julie Grundy is an accessibility expert who works for Intopia, a digital accessibility consultancy. She has over 15 years experience as a front-end web developer in the health and education sectors. She believes in the democratic web and aims to unlock digital worlds for as many people as possible. In her spare time, she knits very slowly and chases very quickly after her two whippets.

More articles by Julie




custom

This Chennai-based startup customises your sneakers so you can put your personality on them

Pastels, bling, or bold colours, whatever be your taste, K-kix, a sneaker customisation platform from Chennai can do it for you



  • Life &amp; Style

custom

Customs detains Shashi Tharoor’s aide in alleged gold smuggling case

Customs officials detain Shiv Kumar Prasad for allegedly receiving 500-gram gold chain from passenger Dharmendra Dubey at IGI airport