Smashing Podcast Episode 35 With Stephanie Stimac & Melanie Richards: What’s Next For HTML Controls?

In this episode, we’re talking about HTML controls. Why are they so hard to style, and how might that change in the future? Drew McLellan talks to Microsoft’s Stephanie Stimac and Melanie Richards to find out.

Show Notes

Weekly Update

Transcript

Drew McLellan: My first guest is a program manager for Microsoft Edge developer experiences, but prefers to think of herself as a designer, front-end developer and developer advocate for Microsoft Edge. My second guest is also a program manager for Microsoft Edge focused on the web platform. She too has a background in web design and front end development. She loves designing and building fun things for the web and is currently doubling in 3D art.

Drew: So we know that they’re both experienced web developers working hard to move the web platform forward, but did you know together they won the Kentucky Derby dressed as a pantomime horse? My smashing friends, please welcome Stephanie Stimac and Melanie Richards. Hi Stephanie. Hi Melanie. How are you?

Stephanie Stimac: I am smashing.

Melanie Richards: I’m also simply smashing.

Drew: It’s been probably about a year Stephanie, since we last had you on the podcast, and you have the dubious honor of being our first ever return guest. At that point a year ago, Edge was transitioning over to a chromium rendering engine.

Drew: Melanie, I’m guessing that that transition was a big deal for your team on web platform as well. How have things been over the last year? Has the transition been smooth and successful?

Stephanie: I think so. So I think Gavin, we talked last, we were just rolling out our stable version across some platforms. And now we’re on Linux as well, and there’s been just so much good reception from the developer community, people are excited to use Edge, so the reception has been really great and I know for developer experiences. We’ve been working on some fun stuff that’s coming up still soon, but it’s been really good.

Drew: That’s amazing. I didn’t realize that Edge was also available on Linux now, because it’s been on the Mac for a while as well, which is great to be able to run a page on a Mac. I mean, windows obviously being the sort of dominant desktop operating system. The role is the primary browser on that platform is sort of fairly immense.

Drew: And there’s been a bit of a spotty history when it comes to Microsoft and it’s browsers, I think we can be honest about that. Sometimes leading the way and then maybe stumbling for a little bit and getting left behind. But we all know as developers the pain that comes from such an important browse not being up to par. So it’s great to see that now it’s a really first-class experience for users, but also for developers too with edge, with all sorts of development tools and at a really first-class experience in that regard as well.

Melanie: Yeah, it’s been wonderful for us on the team, because we’ve had kind of a true opportunity to help push the web forward a little bit more. When we were kind of building on top of edge HTML, there were some areas where we had to play catch up on certain APIs.

Melanie: And now that we’re collaborating and bringing new ideas into the chromium code base and to standards, it becomes a lot easier to say, okay, what’s next? How can we solve problems for developers and for our users? So, it’s kind of been a joy collaborating with folks across the different companies on this one.

Drew: It feels very natural that it should be a collaborative experience and that’s kind of what the web is designed to be, right?

Melanie: Absolutely.

Drew: So, I wanted to talk to you both today about HTML controls. And that term itself, I guess is wrapped up in quite a bit of sort of platform specification jargon. What do we mean in practical terms when we’re talking about HTML controls and what are the sort of problems that designers and developers might counter with them on an everyday project?

Melanie: Yeah, so primarily we’re thinking about form controls that enable user input in some fashion. So you have your Slack, your radio, checkbox, buttons, this extends also to the video player and controls as well.

Melanie: So I think something that a lot of us have experienced as far as participants in this customizable controls effort have experienced personally, is sort of wrestling with getting these controls to fit the brand and the user experience that we’re going after for our particular user base.

Melanie: So, there’s things that seem like they should be fairly trivial, just getting the right colors in select options. And the fact that you have to just completely recreate a control in order to do that, to align to your branding, which is something that a lot of projects require that is so challenging.

Melanie: I saw a tweet a couple months back when we were talking about this with some other browser vendors. Someone was saying, Oh, you want icons in your select options, you have one problem. So you recreate the select and now you have 37 problems.

Melanie: There’s so many things that you have to manage as a designer developer, getting the accessibility right, and there’s so many different dimensions of that, the semantics, the keyboard interactions, high contrast, supporting different color schemes, that sort of thing. And we find that folks are just recreating these all over the place, several different frameworks even within the same company, a lot of developer designer energy being put into this and it’s like, okay, what if we could just make it easier to use the things out of the box and build on top of those and not have to recreate the wheel here?

Drew: I think there was this sort of concept with early implementation of form controls, that they should look like they’re native to the operating system. Which you can kind of understand from a view of wanting consistency across the user experience for the whole of the operating system.

Drew: We’ve all used desktop apps, particularly cross-platform ones that implement their own controls rather than using the native ones and that experience can be really horrible. So you can see where that thinking has come from. But I think it’s sort of almost a false promise that there is a consistent experience, because the controls in a webpage never really behaved in the same way as the controls in native applications and operating system, they never really functioned like native controls. So it was sort of a coat of paint, but not really providing the same user experience. Was it?

Stephanie: Right. So yeah, I’ve dived into the history of controls a little bit, and I think in the beginning they did behave like native platform controls, because in the early days of the web, it was the underlying operating system that was sort of rendering those controls.

Stephanie: And then this idea that developers wanted more control over functionality and style. I was reading a blog post from I think, 2001, and so like CSS had finally just been standardized and was sort of embraced as the main styling language and people were trying to style controls and just have more control over controls.

Stephanie: And that led to, I think, and even today that’s led to a huge sort of, I think, discrepancy in the way that they function. Like Melanie said that you have people recreating form controls from scratch, and they may not mimic native form controls at all their functionality. So you’ll have a select that maybe behaves differently on one website than another one.

Stephanie: So the experience can be pretty jarring. And I think even across different platforms too, we have native controls that don’t behave the same way, they behave differently on different platforms. So it does create sort of this interesting problem space for developers when you’re thinking about user experience.

Drew: When you think about all the things that run on the web platform, sort of banking and healthcare services and emergency response, governments, e-commerce, global economies basically are running on top of the web platform these days, through various ways of means. And that’s all built on top of a few HTML controls from 25 years ago, pretty much, they’ve been the same for decades. And they’re pretty terrible really, aren’t they? They’re basic.

Drew: But how did we get to this point where they got so left behind, and nobody sort of touched them for so long? How have we got to the point on the web platform where sort of the weakest link is input controls?

Melanie: Yeah, I think that’s a pretty big challenge, something that we think about quite a lot as browser vendors and as participants in standards is web compatibility. This comes up all the time, you’re thinking about, Oh, should we make this change to CSS or should we tweak this a little bit?

Melanie: And maybe it makes a lot of logical sense for the way people are building today. It makes a lot of logical sense for developer ergonomics, but someone goes, Hey, wait a second, if we make that change, these millions of sites are going to blow up in unexpected ways. There’s just an example on some of these controls where people are applying CSS styles that have no effect today.

Melanie: So if we said, okay, actually we’re going to allow this or that property on a certain control, now, some of these sites are going to do very funky things. So I think because controls are involved in such mission critical flows as you kind of pointed out, people are a little bit nervous about changing something so fundamental to the web in a way that is backwards compatible and won’t break anything.

Melanie: So we kind of have to think about the controls problem in an additive way. And some of the other challenges here are that every browser has kind of implemented their controls under the hood in a different fashion. So some are kind of doing something that’s a little bit orthogonal to the operating system, some are still leaning quite heavily on the operating system, and that can change for the same browser in different platforms. So you have to kind of take all those things into account.

Melanie: I think it’s a tough problem, but I am feeling the winds of change here, everybody recognizes, okay, we need to go and solve this problem, it’s going to take a long time, It’s going to be hard, but let’s try.

Stephanie: To add on top of that too, so I’ve been sitting in on our meetings with Melanie and the open UI initiative that’s sort of leading the standardization of controls. And I don’t think people realize either, like Melanie said, it’s a huge undertaking. And there are some meetings we have that get into such granular detail about the way a select behaves, just to a level that even kind of blows my mind at how specific these problems are that we have to think about. So it is a huge undertaking.

Drew: There was an effort, wasn’t there? With HTML5 to improve things a little bit, and there were some new types for the input element and there was some basic validation capability and the constraint validation API, but it was kind of a subtle evolution, not a revolution, was it successful, do you think?

Melanie: I think that effort did add some necessary capabilities to the web platform, but I think there’s some feeling about the type attribute, maybe we should go a different way in the future, but that type of attribute does a lot. You kind of inherit a lot of behaviors from the base input class that maybe isn’t applicable to that particular element. Maybe there’s a different way to do this and have more purpose-built specific elements so that’s kind of what we’re looking at.

Drew: I think of things like the way that data input works currently with HTML5 or I say works, doesn’t work maybe. You have to sort of just look at the fact that every single site is building custom calendar controls rather than using that native date picker, because the date picker isn’t serving that need. And you kind of have to conclude that some of these native methods have just completely failed.

Melanie: Right. And the date picker is such an interesting one, because I feel there’s two buckets as to why people recreate those. In some cases it’s like, yeah, I want it to basically function as a date picker does, but I really need it to be style to match my own branding. And that day picker control is doing a lot of work, there’s a lot of stuff going on in this one tiny little pop-up world.

Melanie: And then on the other side of the house, you have airline websites, right? Where they’re trying to do something that’s different, that can’t be supported by that date picker control where you’re really looking at range, I can cross different months and that sort of thing. So yeah, that one’s a tricky one, there’s a lot of different use cases packed into one control.

Drew: How can we avoid new sort of falling into that trap again in the future? obviously that’s an example of something that was too complex, obviously very complex to implement, because some rendering engines didn’t even try and others that did try had varying levels of success. How do we avoid falling into that trap in the future? Can we?

Melanie: Yeah. It’s an interesting question, so I think some of the proposals that we’ve made around customizable controls are meant to offer folks a little bit more flexibility with the inbuilt controls, more control over those, if you will.

Melanie: So just kind of break down our basic proposal here, we imagine there’s a couple different solutions for customizable controls, and the right solution sort of depends on the use case and the particular control and how complex it is really. So the different kind of buckets are, we want to have some sort of standardized internal structure to the controls, so named parts basically. And we can create pseudo elements that can target the specific parts.

Melanie: So Greg Whitworth over at Salesforce actually has a proposal that he’s pulling over around a pseudo element for the checkbox and radio indicators, so looking forward to that kind of coming online in that bucket. Then we also looking at name slots, so let’s say that you’re a web developer, the base control mostly works for you, but you just want to replace one little piece of the control.

Melanie: So maybe the button you part of a select, for example. You can just swap out that name to slot. And then if you really want to go truly custom, you can actually completely replace the shadow domino control with the attached added method.

Melanie: And so the idea here is that the developer would have control over the view of the control, and they would still rely on the controller code coming from the web platform to kind of hook up things between the model, so certain data points in the control and the view, so they wouldn’t have to kind of do that underlying logic themselves.

Melanie: So, those are the kind of strategies that we have as far as being able to leverage what’s already been done but really customize it to your use case.

Drew: So that’s sort of getting around this problem that a lot of controls are just kind of a black box on there that’s inserted into the page and you can’t do anything much with it. Replaced elements, is that the right terminology?

Melanie: Yes.

Drew: Yes. So, there’s no way then with CSS or with JavaScript to actually target bits inside it, it’s just a box and you can’t get into it. So the idea here that you’re describing is structuring controls so they’re much more like something that we might build ourselves, with different levels of containers and items in it, so that each of those individual bits can be targeted.

Drew: And then some of them might be named, and so you could keep the basic control but swap out the slots. So if you had a file upload control, you might be able to swap the button with a button of your own choosing, but keep the general functionality implemented by the web platform, am I understanding that right?

Melanie: Yeah, that’s absolutely correct, yeah. We want to make it easier to kind of reach directly into that control and kind of take the pieces you need and update the pieces that you need as well.

Drew: Yeah, that sounds really exciting. But to play devil’s advocate as is my job sometimes, do we really need HTML controls at all? And I think at the number of forms that are being submitted with JavaScript using the fetch API, you can gather some data and make a post request or what have you. And you can take any element and turn on content editable and have the user be able to type in some text or what have you. Do we need native form controls or should we just go rogue and build it all ourselves?

Melanie: Pardon me, that carries a whole lot about accessibility is like "ahhh!", Hopefully that screech doesn’t sound too awful on the mic here, but. I think I’m a huge fan of the semantic web, right? And having things that are truly built for their purpose. Again, there’s a lot of things that you have to get right so that people who are using assistive technologies, for example, really know what they’re interacting with and their assistant technologies know how to inputs their actions and their data into that control as well.

Melanie: And so, clarity over the items that you’re working with really decreases if you kind of just throw a content editable on everything. And then, I feel like JavaScript is eating the world and here’s where I start getting nervous about going into controversial territory and just say the word JavaScript and people are like, what? Pop out of the woodwork.

Melanie: But people can just say, well JavaScript in their browsers or content can be kind of ingested into other environments. And so I still feel it’s super important to work with HTML, work declaratively, don’t necessarily depend on JavaScript for everything, provide a progressively enhanced experience, so.

Drew: I think when you look at the difference between how different controls are rendered on a desktop web page, versus the experience in a mobile browser, think of something like a select control, the interface is completely different on a mobile device, isn’t it? It’s not just whatever the developers built with divs and CSS on the page, the browser just completely takes that over and gives you a different experience.

Drew: That’s more appropriate to the device in question. So I think that’s definitely sort of a glimpse into the predicament that those who are using assistive technologies face when they come up against using things that are completely custom and not based on real solid HTML elements.

Melanie: Right. And it’s tricky if you are a person who’s interacting with the same basic control from site to site, but you have to like relearn how to use that control, because this website decided to use arrow keys to traverse through these items. And this site decided to use tab keys or the tab key. And it’s like, come on, that’s such heavy cognitive overload for folks who are just trying to go about their day.

Drew: Definitely, there’s awful a lot to think about when you go rogue, isn’t there? In terms of accessibility, keyboard use, focus, all these sorts of things that really add an awful lot of code to something that could be quite simple and you could just put the right elements in and get on with your day.

Drew: It’s a real frustration for us developers to try and style the form elements to make them work in the way we want to. And I get the feeling that just about every designer and developer would want to have better native controls. Is that something that you’ve seen in your own research into the developer community Stephanie?

Stephanie: So, yeah, we’ve actually seen that in the developer community. So about a year and a half ago, Greg Whitworth, who is at Salesforce and leading the open UI initiative, ran a survey on Twitter with about 1400 respondents to sort of find out if this controls pain point was... Or I’m sorry, I guess it’s two and a half years ago now 2020 was a blur.

Melanie: By this time.

Stephanie: Yeah. And he was trying to dive deep to see if this controls area was something that web platform team should go invest in. And the biggest reason for developers making their own controls or rebuilding them from scratch was, because they couldn’t change the appearance sufficiently, I think that was about like a third of developers. And then, I think about another third said, because of browser inconsistencies and I think you can assume that that probably has to do with the parents also. So that’s a lot of developer hours being spent rebuilding these things just to change the appearance.

Stephanie: And so Greg sort of identified that, yes, this was a pain point and being the PM that I am, I sort of wanted to find out how big of a pain point it was for developers. So I did my own sort of impromptu gorilla research on Twitter and asked people, how painful is this for you? And I got about 250 responses to this tweet.

Stephanie: And I had asked, what would you rather do than style a select menu? And responses ranged from I would rather chew on glass or boil my toes in lava than attempt to style a native select element to... I’d rather have to build the site and have it be compatible with IE6. So this is a huge, huge pain point for developers. So it’s been a pretty consistent theme that developers aren’t happy with what is there. So.

Drew: There’s been a bit of an effort from the various browsers to have a little bit of a design refresh lately of some of the form controls and try and take some of the opinion out of the design. We have lots of sort of gradients and things going on, didn’t we, in all sorts, which I guess is a primary reason for people wanting to style them in the first place. To try and get a bit of a more neutral look that doesn’t clash at least with their site’s design. Was that something that edge was involved in? I know that it happened in Chrome, was it driven by chromium or was that just Chrome doing it, or how has that worked?

Melanie: I think that’s actually a prime example of some of the cross-company collaboration we’ve been able to do since moving to chromium. So actually on the Microsoft edge side, all of us PMs on the platform are taking just the review of, okay, here’s all the features that we have in our current edge HTML based browser. What’s kind of the situation over in chromium land?

Melanie: At the time I was working on accessibility, so this looks like collaborating with chromium on bringing support for UI automation that accessibility API over to chromium, force colors, windows high contrast support, support for other system settings, but over in controls land, the team was kind of looking at, what our controls look like today, what are our requirements? What is the situation in chromium?

Melanie: So for the Microsoft edge browser, we run in a lot of contexts where there are touch capabilities, so there’s a lot of PCs that have touch screens, for example. And so, touch capability is really important to our form controls, they have to work well for a larger pointer, which is your finger.

Melanie: And we have this kind of fluent design system, so we were just feeling that there were ways to kind of push the controls a little bit more to align to our aesthetic, our touch requirements, our accessibility requirements, that sort of thing. And it actually ended up working out perfectly because we talked to the folks over at Google and they’re like, yeah, we’d love to kind of update, refresh the controls and make them feel more modern.

Melanie: So it was really tight collaboration between the companies to land on something that works for our aesthetic, their aesthetic, the aesthetic of other browsers that are also building on top of chromium. Find something that’s a good middle ground there and then it’s extensible. So yeah, lots of collaboration, it’s still ongoing actually, we’re actually just doing work on the controls refresh for Android, for example, so, lots of cool stuff to do.

Drew: So, sort of looking at further ahead than a design refresh. Are there plans for any sort of new native components coming up?

Melanie: Oh, yeah. Funny that you should ask, because we actually just published an explainer just the other day, for a new pop-up element that I’m very excited about. So I had kind of mentioned that we had proposed a couple of different capabilities for customizable controls. We sent an intent to prototype in the chromium project with a customizable select, ITPs as they call them are just kind of like, Hey, I’m going to play around the code base, kind of like push on my ideas, see if they’re like truly feasible in implementation. And that kind of happens in parallel to some of the standardization efforts.

Melanie: So we filed an ITP for the customizable select, but part of what we needed, we’re talking about reaching into the shadow dome, reaching into the control, we needed something that worked really well for the list box pop up portion of the select control. And we also kind of talk to some of our partners in different design frameworks and found that there was a more generalized need for a pop-up that can be rendered on the top layer, consistently it can break out of any kind of bounding boxes.

Melanie: We find that a lot of the times developers are kind of just like stuffing, they’re like divvy pop-ups in the bottom of the body, because they’re trying to get around these rendering problems, especially because they can’t actually directly control all the context in which their components show up, because there’s component library. So, we kind of took a look at some of these problems and came up with the pop-up proposal.

Melanie: And so this is for any kind of top layer UI that pops up and has light dismiss behaviors. So, the item should close on escape or loss of focus, things like that. And it’s really designed for transient UI, right? So you can only have one pop-up available at a time, unless there’s an ancestry chain, you can have popups inside popups and there’s different use cases for that.

Melanie: So yeah, this is a really early proposal, we’re really excited about it. But we’d love feedback from the community, we have it posted on the Microsoft edge explainers repo. We’re getting so many great questions, which is really exciting to me to just see people engaged with the idea and really pushing on the details and looking at us browser vendors to get things right. So, super excited about that, please check it out and let us know what you think.

Drew: And the stage that’s at, I’ve seen the explainer, which is a document which describes it all. Is that the state of that, there’s no sort of experiments and codes to play around with. It’s more a conceptual, what if we did this sort of stage, is that right?

Melanie: It is conceptual, but we do also have an intention prototype filed on that one as well. And so that is something that a couple of our close collaborators and Google are helping us with, kind of tinkering with the code right now, so that’s kind of exciting just validating our ideas as we make a proposal to the broader community.

Drew: That’s really exciting, I’ve literally just been working on a project at work that is a really key pop-up in our product interface. And the amount of work that’s involved in making sure that it sort of traps focus correctly and as you were saying, do we then allow somebody to interact with a tab or with arrow keys, or all the tiny details of interaction that are involved in that, making sure it appears at the writers that index above all the things that it should be in front of, what happens if somebody scrolls and then they hit the bottom of the scroll?

Drew: All these sorts of tiny, tiny, subtle bits of interaction that are... they’re not individually, they’re not difficult to code for, but the sum of them is a lot of work and the potential for bugs to creep in there and improve complete usability problem for some segments of your audience. To have that such a common thing implemented potentially as part of the web platform, it’s going to be a massive time saver for everyone, isn’t it?

Melanie: I’m so glad to hear that, that would be a great time saver for you, because yeah, that’s exactly what I’m kind of thinking, it’s like, oh, okay, it’s 20 minutes here, 30 minutes there, but multiply that by every single developer who has to do that, and then maybe you miss something and you get a very upset ticket in your feedback channel. So.

Drew: So is the idea that then something like a popup would be a building block for then a customized select control where it would be the options sort of section?

Melanie: Yes, absolutely. That’s one of the cases where we kind of imagine this showing up and it’s worth mentioning that the pop-up control that we’re kind of putting forward is meant to be a base that you can build on top of, because there’s many different types of pop-up UI and your use case might differ a little bit from your neighbor next to you.

Melanie: But it’s worth mentioning we think that there are some classes of top layer UI that actually could warrant their own additional element to pop up, because the paradigms there are a little bit different from the popup that we’re proposing. And it’s a very well-trodden path, a lot of people are rebuilding this control.

Melanie: But we’re trying to find the right balance here between pushing the platform forward and not wanting to flood it with new elements either.

Drew: Yeah. I mean, that’s an important point, isn’t it? Because we sort of want to be confident that the things that are being added to the platform are an evergreen requirement and not just a current interaction fad. I mean, if you sort of think back to five years ago where every website had an enormous carousel on it, we could have at that point decided, oh right, the web platform needs an enormous carousel control built into it.

Drew: Could have built that, and then once something’s in the platform, it stays forever, right? Basically we don’t take things out, they’ve got to keep working forever. And if people then aren’t using them, then it just becomes technical debt. So is there a way we can safeguard against that to make sure that these things are evergreen and not just a fad?

Melanie: There’s a lot of different stakeholders in web standards and I think a lot of these things happen naturally, there do tend to be pretty strong headwinds against adding a new element, because there is this fear of making the wrong choices and having the big forever or capturing something that’s a fleeting sort of problem.

Melanie: So I think what’s key here is to look at the problems that have been around for the longest time, right? And just listen to the various different stakeholders and what they have to say about the proposal that you’ve made and make sure that we have the best insights from everybody in the industry, all working together towards the best solution.

Stephanie: So, thinking of new elements and sort of what would be put into the platform. So Chrome, I believe is working on a toggle switch element. I believe there’s a prototype up for that, but that’s an element that they have in the works, which is one of those elements that sort of makes sense, that is something that’s sort of fundamental that gets used across so many websites that just, again, that makes sense that there should be a native element for that.

Drew: That’s exciting to hear as well, because the work in sort of progressively enhancing a checkbox, for example, to become a toggle switch is... Yeah, yeah, it’s something that’s best avoided if you can. But a toggle switch as an interface device makes a lot of sense for a lot of cases of turning something on or off and being a yes, no choice. So having that sort of thing as a fundamental part of the web platform would be terrific.

Drew: When we think about all the existing controls that are out there that potentially have problems, can they be fixed? I mean, we can’t throw them away. Well, I guess we could come up with alternatives that new sites could start to use in their place, but can we rescue the current ones? Is there a way that we can keep backwards compatibility and still move them forward?

Melanie: Yeah. So I think that’s an interesting question that it encompasses a broad range, right? I depends on what the issue is, I think, look, browser vendors are not perfect either, we have bugs, we should fix the bugs. So there’s plenty of those items. But again there are some things that are very difficult for compat and just keeping the web working if we just change things underneath people.

Melanie: So for example when we were working through the controls refreshing chromium, some of the designers were like, Oh, what if we make these check boxes in these radius this size? And we’re like, yeah, that’s better for usability, but the problem is they’ve been a certain size on the web forever for everyone and bad things will happen if we change that.

Melanie: So, it’s frustrating a little bit sometimes, because you can imagine a better way of doing something, but you don’t want to break everyone. So I think it depends. That’s probably the eventual answer to every question in web development, isn’t it?

Drew: It depends. I think about things like the select element over the multiple attributes, so you can have not select multiple items in the list. I mean, putting to one side how it looks by default in most browsers, the interaction model for that control is from a different era of computing, isn’t it? So much so that it’s rarely used because a typical web user doesn’t know how to interact with it. Can we address things like that? Is that something that can be fixed?

Melanie: That’s a hard question. I believe there’s a lot of creative people in this space come up with some really interesting ideas. I have to think a little bit about that one, because I agree even as a user that I find that interaction pattern a little bit challenging. So yeah, back to the drawing board I guess.

Drew: So, it depends.

Melanie: Oh man. I’m just going to answer every question that you have from now on with that.

Drew: So, Stephanie mentioned open UI a little bit earlier. What is open UI?

Stephanie: So open UI is an initiative under the YCG, and it is focused on standardizing controls. And so I think not... So controls are standardized, but it’s only their function. So I think that’s where the root of a lot of this problem comes from is back 25 years ago when the initial controls were introduced into the first HTML 2.0 Specification. Their parts weren’t standardized, it was just this form is supposed to complete this function or serve this purpose and that’s sort of what was standardized.

Stephanie: And so that is sort of the problem, different browser engines choose to render their controls or build them differently under the hood. And so we can’t give developers access to the different parts, sort of in a compatible way at the moment. And so open UI at its core is sort of driving that initiative to define, so first select, what is a select comprised of? What are the different parts? And drive that work forward.

Stephanie: And so Greg Whitworth is again driving a lot of that work, but it’s an open initiative, so we’ve had quite a few people from the developer community join in on that and are sort of helping to drive that work with Greg and the rest of the team. And so, yeah, at it’s core it’s just trying to find the different parts of the controls and sort of pave the way to get those into an actual standard specification and eventually into browsers.

Drew: So, this was the internal structure that Melanie was talking about just before of being able to identify different slots and then putting names to the different parts that make up a control so they can be targeted and replaced or styled or whatever, but it’s just making sure that that is consistent across different browsers, standardizing it, working out where they are or should be, and then hopefully that gets implemented and we can start using controls with a lot more precision than we can currently.

Stephanie: Yeah, that’s exactly right.

Drew: And does open UI attempt to address how controls will look?

Melanie: No, that’s outside of the purview of the open UI efforts. So, we’re looking at, if we have an MVC model of controls looking at the M and the C I suppose you can say.

Stephanie: Just to add to that too, sort of standardizing the way they look, like Melanie said, yeah, that’s not really... When you have different companies like Microsoft or the different browsers, Firefox and Chrome and Microsoft, they are different companies with different design languages as well. So even our default styles I think are going to be reflective of the company or the browser. So.

Drew: I think that’s ideal from sort of a development point of view, because if the browser vendors have to implement this new spec, it’s been agreed on, they’re going to implement it. And the first thing they going want do is to use that to style the control themselves to match the language of the browser.

Drew: And any inflexibility or potential problems that might appear down the road for end users are going to appear for the browser developers as they’re implementing that themselves. So it’s a good initial stress test. Can this select box be made to look like it should in edge, made like it should in Chrome and so on.

Melanie: Yeah, I also feel like I’m trying to get all the different browser engines to agree on a style or even just standards group on what this thing should look like would be a... I think that conversation would go on forever, quite frankly.

Drew: And could potentially stifle innovation as well. I think it’s positive that different competing products can compete on the user experience level by bringing their own innovation and hopefully what the specifications will enable us to do is to do that in a way that isn’t going to impact an end user... end web developer who wants to then restyle those controls themselves. It gives everybody the flexibility that they need.

Melanie: Right. Yeah. It’s even just a challenge, even as we’re talking about standardizing the internals of a control, you have to do it in such a way that it could be implemented in a different fashion, or there’s a little bit of room for variety or as you said innovation. So, that is a challenging requirement of this work stream.

Drew: What’s the process of sort of between getting these early ideas? Things that the open UI project might write up. How do we get those to start to become part of a future web specification and then ultimately implemented in browsers. Are we looking at decades of work here? Or, I mean, it’s not going to be a month, is it?

Melanie: I wish. Just kidding, actually, it’s so funny, I was thinking about this the other day, it’s like, as a web developer, your timescale is so much shorter than web standards, it’s like, I would love to have this for this thing that I’m trying to push out next month or whatever, but you actually probably should want us to take a while, because that means that will be very considered in the decisions that the web standards industry makes.

Melanie: So, yeah, I think this is going to be... We’re looking at a couple of years at least to fully go through all the controls. As far as process goes, that’s sort of a little bit of a moving target, the folks who are involved in open UI, some of the chairs and a couple other folks are actually working on a process document for how this sort of works.

Melanie: But I think generally speaking, you can think as open UI as sort of the connective tissue that tells the full story between efforts that might land and what we do, so the living document for HTML or the CSS working group over at the W3C. The open UI group can tell the full story in between these desperate pieces. And then can also provide a maturation ground. So when you’re trying to get work into the HTML spec, that group goes off of PRs, rather than sitting in a room and chatting about it.

Melanie: And so the expectation is the PR should be fairly mature when you make it against that spec. So, perhaps open UI can be the place where you gain that maturity in the idea.

Drew: And the ideas can be thrashed out before they’re then taken onto the next level of being proposed to the actual specification.

Melanie: Yeah, absolutely.

Drew: So how can people get involved in this process to offer feedback? I mean, for example, I know personally I’ve done a lot of content management system development work and that they tend to be very form heavy. And so my individual perspective might be different from somebody who builds online games, and the web has to work for all those use cases. So I guess it’s really important to get lots of points of view into the process. How would people get involved with that?

Stephanie: There’s a couple of different ways that you can go, or you can either get involved in open UI, again, that group is... If you go to open-ui.org I believe, you can find out how to get involved in that and sort of actually be involved in the process of defining control structures and helping us do research, or you could provide feedback on the explainers, so there’s the customizing controls, CY explainer on GitHub under the Microsoft edge explainers repo.

Stephanie: And then also the pop-up explainer that Melanie mentioned. You can open issues or you can just tweet at me or Melanie and there’s some good... I’ve seen some good conversations with the pop-up explainer I think, Melanie’s Twitter feed, so.

Drew: So getting involved in the web platform could be as simple as sending a tweet?

Stephanie: Yes.

Drew: Amazing.

Melanie: We’re all human beings over here so.

Drew: What a time to be alive. So I’ve been learning about the future of HTML controls today. What have you both been learning about lately?

Stephanie: Well, so I’m writing a new talk for dual screen devices and talking about design considerations and I tend to go into the history of, like I’ve done with HTML controls. I like to dive into history and see where we’ve come from and so I’ve been looking at foldable devices and how... There were prototypes in 2008 of actual foldable devices, and so I’ve been diving into that and learning about that for my next talk.

Melanie: I feel like I have too many plates spinning at all times to start learning new things, but in addition to this controls work I’m also focused on the pricey space in the web platform, so very different space actually, which is very interesting. But learning a lot right now about identity and federated off use cases as that relates to privacy.

Melanie: So that’s been super interesting, collaborating with folks who have a lot of depth of expertise there. And outside of the web platform, I don’t know, always doing different stuff. You mentioned doing three arts, I’m taking, Devon Ko’s 3D for Designers course that’s been fun. Learning a little bit of Japanese. So working through my Kanji lessons. So doing fiber arts and then I was like, what if I learn Python? I’m like, no, no, no. I can’t add more things to this list.

Drew: Rein it in. That’s amazing. If you dear listener would like to hear more from our guests, you can find Stephanie on Twitter where she’s @seaotta with an A and her personal site is stephaniestimac.com.

Drew: Melanie can be found on Twitter where she’s @soMelanieSaid, and her website is Melanie-richards.com. And the open UI course is open-ui.org. Thank you both for joining me today. Do you have any parting words?

Stephanie: I have to say I’m excited about the controls work that Melanie is leading, and there’s just some good stuff coming in. So I hope developers get involved and are as excited as we are.

Melanie: Major plus one to that. Thanks so much for having us on today.

How to Translate a Language in Java

Since the internet stepped into the spotlight in the late twentieth century, it has been doing its part to facilitate globalization on a massive scale. With companies increasing international transactions and individuals from across the world connecting online, we are all growing closer each day. 

While these personal and business connections are teaching us a lot about our various cultures, we still encounter language barriers. These barriers can cause considerable inconvenience and frustration for users and businesses alike, which is why the developments that have been made in language translation technology are so valuable.

10 Database Optimization Best Practices for Web Developers

Database optimization has become crucial to web developers for improving the performance of web applications and thus bettering user experience. It might sound a bit unappealing to some, but the benefits are worth the work. If you optimize your database properly, you’ll improve performance, reduce bottlenecks, and save resources.

Luckily, there are some optimization techniques that don’t require DBA-level (database administrator) expertise in SQL-queries.

How DevOps Will Change Now That Remote Working Is Here to Stay

As we all know, the way we work has changed forever and fundamentally. What started as a temporary shift to adapt to the pandemic has actually revealed several issues and outdated working practices. 

Now, software like Slack and the many 8x8 competitors out there feel as if they’ve always been with us. Soon, large swathes of office space will likely disappear, and some people may not feel the need to come into the office at all. Remote work is here to stay. 

WP Engine Invests in Headless WordPress, Hires WPGraphQL Maintainer

WP Engine is deepening its investment in headless WordPress with the creation of a new team dedicated to furthering the technology developers rely on when opting for this architecture. The company has hired WPGraphQL creator and maintainer Jason Bahl as part of this new team and will be investing in more engineers and other roles to support decoupled setups.

For the past 18 months, Gatsby has funded Bahl’s time on WPGraphQL’s maintenance and development. During that time, the project had 53 releases, went from ~15,000 installs reported on Packagist.org to more than 85,000, and launched the plugin on WordPress.org with more than 8,000 installs active today and a 5-star average rating. The community around the project is also growing and has contributed more than 30 plugins to the library of WPGraphQL extensions.

“Gatsby’s investment in WPGraphQL signaled that it wasn’t just a hobby project, but was solving real problems for real users, and users should have confidence using it in their projects,” Bahl said.

After Gatsby started transitioning Bahl to work more on other Gatsby integrations, such as Contentful and Shopify, it translated into less time to work on WordPress and WPGraphQL. This prompted him to seek out another employer where he could prioritize working on headless WordPress.

“I feel right now is a unique time in history where more investment in WordPress as a headless CMS can change the future of WordPress,” Bahl said. “I believe WordPress is now more respected as a viable option for a headless CMS and that with the momentum of WPGraphQL, technologies like Gatsby, NextJS, and others, I need to spend more time focusing on WPGraphQL and headless WordPress, and not less time.”

Bahl found WP Engine at the right time and will be focusing on maintaining WPGraphQL and working on wider headless WordPress initiatives.

“We’re going to be investing in headless WordPress, both in expanding our existing business as well as giving back to the community, as we have done for the past eleven years,” WP Engine founder and CTO Jason Cohen said.

“We’re already seeing some customers moving to headless.  While we don’t see the majority of WordPress sites doing that anytime soon, we do want to invest in those who are.”

In the meantime, WP Engine is creating a Headless WordPress Framework that is in the early stages of development. The framework uses WPGraphQL and provides a plugin, a set of npm packages, and guides for creating headless WordPress sites using Next.js.

“GraphQL as a protocol offers a lot of advantages over REST, which is why it is being used so much, even by players outside of WordPress, like Gatsby,” Cohen said. “GraphQL includes type-safe schemas, is more discoverable, is easier to federate, and because it allows the clients so much flexibility in what data it wants (and does not want), it often results in fewer back-and-forth calls between client and server, while reducing the data being transferred to only that which the client actually needs. Because of the advantages of GraphQL, we believe a mature GraphQL API for WordPress will empower developers and site owners to move faster and with more confidence when they choose to go headless with WordPress.”

Bahl said WP Engine’s investment in headless WordPress isn’t limited to him continuing work on WPGraphQL. The company plans to hire more engineers for projects aimed at reducing the friction that developers and businesses experience when using WordPress as a headless CMS.

“I believe that WP Engine’s investment in this space will allow WPGraphQL to grow and mature faster than ever before, as I will be part of a larger team working to make WordPress the best it can be,” Bahl said.

Rough Pixels Releases Empt Lite, a Block-Supported Freemium WordPress Theme

Single blog post view when using the Empt Lite WordPress theme.
Single post view.

Empt Lite, the latest theme by Rough Pixels, landed in the WordPress theme directory today. Like most of the company’s prior work, the design is on par with the best free themes currently available.

I have come to disregard that icky feeling whenever I see “Lite” attached to a theme name, at least when it falls under the Rough Pixels brand. The company does not deal in the stripped-down lite themes I wrote about a couple of weeks ago. Empt Lite is one of those rare themes that does not downgrade the experience with the free version. Most additional features in the pro version seem to be value-adds for users who need something extra. There is almost an honesty to it. Users can get a feel for the theme quality before deciding to hand over money for the commercial version.

Some pro features probably do not make sense as an upsell in the long run. WordPress’s upcoming Full Site Editing (FSE) could make them obsolete. For example, an option for customizing archive titles will be easy to accomplish in the site editor. An “about me” widget will not be a great upsell a year from now. However, custom patterns for an “about me” section might make more sense.

This is assuming the theme developer goes down the block-based theme path in the months to come. Looking at theme releases in 2021 needs to be done with an eye toward how they might function in an FSE world. This includes what freemium-based theme companies are upselling. Some will likely need to change tactics in time.

The one missing feature that I would like to see Rough Pixels include in this theme and others is custom block patterns. They are already covering all of their bases with block editor styles. Now that patterns have been in WordPress since version 5.5, it is time to keep building on the work already in place. This is also an opportunity to transition toward selling design-based upgrades. Put together some custom pattern packages and see what type of feedback customers provide.

Theme Features

In essence, Empt Lite is mostly a standard blogging theme. Where it shines is its support of the block editor.

Cover block output on the front end by the Empt Lite WordPress theme.
Wide-aligned Cover block.

One of the surest signs of a theme author doing their due diligence with block styles is to test a full-aligned Cover block with text afterward. If the text butts against the Cover, the theme probably has numerous other issues. If there is spacing between the two, the theme author likely took the time to test almost all WordPress blocks in various scenarios. I promise you this test works 90% of the time. Empt Lite passed this test and my entire block-testing suite with ease.

The feature that immediately caught my eye was the gallery-style blog layout. Rather than the typical top-aligned or masonry-type grids, the theme employs an offset style reminiscent of the Twenty Twenty-One theme’s image and gallery patterns. The effect is achieved by using varying featured image orientations, which the theme aligns to the middle. It is a break from the monotony of typical layouts.

Gallery-style blog layout for the Empt Lite theme.
Offset, gallery-style layout.

This gallery style does require that every post have a featured image. Posts without them simply disappear from the blog and archive pages, but not completely. These posts leave empty gaps, throwing off the layout. Their titles appear when hovering over seemingly-random spots on the page. There is also an empty <figure> tag in the source code. These are obviously bugs. If the theme author wants to support posts without featured images, the easiest solution would be to add a fallback.

Users who love to customize their theme and make it their own will find enough theme options to whet their appetites. Whether it is colors and typography or post meta and the nine sidebars, the theme has settings to cover it. Outside of the gallery blog layout, none of the customizer options seemed groundbreaking.

If anything, I look forward to the day when theme authors do not have to build all of these options and relegate them to the site editor. Rough Pixels and others put so much custom code behind the customizer that it feels like a waste of development hours in the long term. FSE cannot get here soon enough.

The theme has a few noticeable issues, but they are relatively trivial.

The mouse cursor is set to “pointer” when hovering a post featured image, even when that image is not linked. Yes, I unsuccessfully attempted to click a featured image multiple times, wondering why it was doing nothing.

The wide-layout for single posts provides plenty of breathing room for custom layouts. However, the default font-size, set to 17px, is too small for comfortable long-form reading. There is an option to customize the size, but it applies to the text across the entire site and not just the post content on single views. Making it larger creates the opposite problem on non-single pages. When a project is billed as a blog theme, words-per-line matter. Nailing the typography is a must, even when it is on an alternative layout option. Outside of this one case, the theme gets the defaults right.

The default quote style can make the text tough to read. The quote icon in the background bleeds too much into the foreground. I love the style; the color just needs to be dialed back while letting the text take center stage. The theme provides an option for changing the blockquote icon’s color. I suggest tinkering with it.

Empt Lite WordPress theme's blockquote output style.
Blockquote style.

Overall, this is one of the better themes to land in the WordPress theme directory in the past few months. Recreating the theme’s demo requires almost no fuss. The typography is on-point for a blogging theme, and it works well with the block editor.

Never Import Messy Spreadsheets Again

You’re probably familiar with the numerous stats dedicated to customer retention. For example, customer acquisition is 5 times more expensive than retention. Providing an exceptional customer experience is critical to keeping customers happy. For most B2B technology companies, this starts with the onboarding process.  

But data onboarding—that critical first step of bringing customer data into a platform—isn’t as well understood or discussed. Fortunately for frustrated software customers everywhere, that’s changing. 

Data onboarding is an emerging category with a big impact: getting your customers to reap value from your product faster and with fewer demands on your internal engineering and customer success teams.

Data onboarding is a problem for companies of all sizes

According to a data onboarding survey that Flatfile recently conducted, 23% of software companies state that it can take weeks or months to import customer data, and 96% reported that they have run into problems while doing so. 

Importing CSV files isn’t enjoyable for the customers prepping them, for the developers building the import function, or for the customer service and success teams fielding constant data import questions. 

CRMs, ERPs, product lifecycle management software, and inventory management software are just a few of the many software categories that necessitate data importing. Without customer data, they’re useless. Unfortunately, importing customer data into these software tools is easier said than done. And a poor data onboarding experience has repercussions.

If an enterprise software provider lacks simple and effective data import capabilities, customer frustration and churn could be the result. In addition, companies typically waste precious time and resources having internal teams format spreadsheet errors, fix validation problems, and generally wrangle spreadsheets on behalf of their customers who are simply trying to import their data.

Companies face a build vs. buy decision for importing data

Importing data is essential to get customers onboarded quickly, gaining value from a software platform. But it turns out that building a high quality data importer is both costly and time-consuming. Essentially, it’s a product in and of itself. 

Your engineering and product teams are busy building out new features that matter to your customers and fixing bugs for critical functionality. Building a data importer is not typically on their growing to-do list.

When companies build their own data importers in house, the inevitable occurs: 

  • The team can’t give a data importer the full attention it deserves so they’re likely to produce something that isn’t intuitive for customers to use and doesn’t offer clear troubleshooting steps when an import fails. 
  • Maintaining a data importer requires ongoing work. Once a data importer is built, there needs to be dedicated resources to update, fix and add new features to the importer.

There is, however, another option. Software companies can choose to buy a data onboarding solution to import data rather than build one from scratch. 

John Baigent, the co-founder of Oversight Software and a customer of Flatfile’s data importer, Portal, says, “We aren’t spending precious time reinventing the wheel in terms of file upload, we’re spending our time developing features that our customers want to see and subsequently make their jobs easier.”

The ROI of a pre-built data importer

Startups like ParrotMob and TableCloth are using Flatfile Portal to solve their data import challenges. Early-stage startups, in particular, shouldn’t waste resources on building and maintaining a data importer. Michael McCarthy, CEO of Inkit describes the potential losses from a poorly built importer. “We had two clients that were paying upwards of $30,000 a year and were at risk to churn if we didn’t figure our data import issue out,” McCarthy says. 

“Without Flatfile, we would have had to dedicate one or two full time engineers to the development and maintenance of an internal data import solution and honestly, it would never have been as good as Flatfile’s product,” says McCarthy. “I could see a bigger company looking at a million dollars a year in cost savings.”

Flatfile leads the emerging data onboarding category

Effective data import is an essential part of a larger category that’s on the rise: data onboarding. 

Successful data onboarding ensures that it’s as easy as possible to bring customer data into a product – whether customers themselves are migrating the data or a customer success team (as part of a white-glove onboarding experience). When data onboarding works, customer onboarding is a whole lot smoother and extensive time is no longer dedicated to asking: did the data import go okay?!

Flatfile is setting a new standard in data onboarding with two innovative business products: 

Thanks to Flatfile, companies of all sizes no longer need to waste time on patchwork solutions like emailing sensitive Excel files, formatting CSV templates, or hiring expensive teams to help onboard customer data.

The post Never Import Messy Spreadsheets Again appeared first on Codrops.

Managing CSS Z-Index In Large Projects

There are several articles that explain z-index (here’s a good one), since it continues to trip up developers of all experience levels. I do not think that the number of articles is a sign that none of them do a good job at explaining it, but that there are a lot of developers out there and just because one developer read and understood the article doesn’t necessarily mean that everyone on their team read and understands it now. While taking the time to better understand how z-index (or any piece of technology) works will definitely set you up to work with it better, we can also take another approach: make it easier to work with z-index.

We use abstractions and conventions to hide away the tricky and error-prone parts, which in turn makes it easier for everyone who needs to do the same task. I had the opportunity to attempt to make z-index easier to work with for my team while working on a redesign of our company’s website. The system I designed allowed my team to implement the entire UI while never having to question what a certain z-index value was used for, what number to use when adding a new z-index declaration, or how to fix stacking bugs that crept into the system.

Common Solution

The most common system I’ve seen for managing z-index values — other than no system — is setting several general-use values, each separated by an arbitrary number. This solution definitely tames z-index issues, but as I’ve worked on teams that use this system there still seems to be confusion about how to use it properly. Here is an example from the Bootstrap documentation.

$zindex-dropdown:       1000;
$zindex-sticky:         1020;
$zindex-fixed:          1030;
$zindex-modal-backdrop: 1040;
$zindex-modal:          1050;
$zindex-popover:        1060;
$zindex-tooltip:        1070;

Bootstrap defines z-index values in Sass variables like $zindex-dropdown, $zindex-sticky, and $zindex-fixed. Those names seem pretty straight forward, but when a developer goes to choose a value for a feature they’re working on, there could be confusion as to which value is most appropriate for their use. They end up asking, “Is what I’m implementing a ‘dropdown’ or a ‘popover’?” which can easily be debated and may not have a clear answer.

A second issue I see with this solution is that the actual values for the variables might seem confusing or lead to insecurity. This solution leaves space in between each value to give developers space to add their own values in between if necessary. Bootstrap defines seven values separated by increments of 10, starting at 1000 and ending at 1070.

Many questions could come to mind when reading this:

“Why start at 1000?

“Is there anything less than 1000?”

“Where is 1010? Is it a bug? Is something else using it?”

“Why was 10 chosen? What if I need more than 9 values to go in between?”

Though I’ve never actually needed these “what if” questions answered, they can add insecurity and confusion to a system that already seems magical and misunderstood. Can we remove all of these concerns, allowing the developer to easily and accurately choose the z-index value they need?

A New Solution

Since working on a redesign gave my team a fresh start, this was one common issue we wanted to see if we could avoid. To align with our general coding standards, my goals for managing z-index was to avoid magic numbers and to make it easier for every team member to confidently contribute. The second goal of making it easier for others is vague, so I focused on trying to solve these common issues:

  • People often choose arbitrarily large z-index values;
  • z-index bug fixes often result in a new z-index bug;
  • The relationship between z-index values is difficult to trace.

Let’s look at solutions for each of these issues that I was able to apply, leaning on conventions and using existing technologies.

Giving Z-Index Values Semantics

One reason people often choose arbitrarily large z-index values is because they don’t know the z-index value of the item above which they are trying to place a new item. Once they find an arbitrarily high value that works, they leave it instead of finding an optimal value. Later on, when someone finds this value they have no idea why it is what it is, and even the original author may have forgotten.

z-index: 9999;

The solution for fixing “magic numbers” like this is by using a named constant instead. While naming the value alone does not give us much more value than the class name does, when we put our z-index constants together, their relationship starts to become explicit.

To remove the magic numbers, I first started defining all of our z-index values in a JavaScript file. I used a JavaScript file since our application was using a CSS-in-JS solution, though this and the ideas in this article can be implemented with styling preprocessors like Sass variables as well as in CSS using custom properties.

export const backdrop = 0;
export const openButton = 1;
export const dropdown = 2;

With z-index constants, the CSS value has little more meaning, and the actual value is obscured away.

css`
  z-index: ${backdrop};
`;

This also makes the original value easy to find, revealing the related constants, but there is a further improvement that can be made. We know by how z-index works that these values are related to each other, so we can change our constants to make that more apparent.

export const backdrop = 0;
export const openButton = backdrop + 1;
export const dropdown = openButton + 1;

Using simple arithmetic, we can use the previous constants to make the next constant. Taking this idea one step further to further eliminate ambiguity, I added some utility constants to make these definitions read more like a sentence.

const base = 0;
const above = 1;

export const backdrop = base;
export const openButton = above + backdrop;
export const dropdown = above + openButton;

Now when someone sees a line like z-index: ${dropdown}; they can look find the dropdown’s definition and read, “The dropdown is above the open button.”

This makes future maintenance of the constants easier. Whenever you have a new value to add, you can be confident that you are adding it to the right place.

export const backdrop = base;
export const openButton = above + backdrop;
export const dropdown = above + openButton;
export const closeButton = above + dropdown; // new

Deleting values is easy too, but you need to remember to update any other values that are dependent on it. Using JavaScript, the linter highlighted this for me.

Stacking bug tickets often show up that say something like, “the dropdown is overlapping with the button when it should be underneath.” When coming across these, the fix is as simple as swapping the relationship pointers in the definitions.

export const backdrop = base;
export const dropdown = above + backdrop;
export const openButton = above + dropdown;
export const closeButton = above + dropdown; // ???

Now that we’ve swapped the z-index order, we notice another potential bug before we even check the browser. The close button might now conflict with the open button. You can now have the necessary conversations to resolve bugs before anyone sees a problem in production.

One extra piece I found to be helpful in rare situations was a utility for placing items below others. To avoid mixing above and below, I made the rule that below should only be used for negative values.

const base = 0;
const above = 1;
const below = -1;

export const backdrop = below + dropdown;
export const dropdown = below + button;
export const button = base;

In this system, every z-index value is only as high as it needs to be, and since it’s dynamically chosen, you aren’t concerned with what the value actually is.

You can also delete and add values knowing with confidence how it will affect the other stacked elements.

Once our application ended up with a dozen or so z-index constants, though it started to become a little bit confusing having a long flat list.

Organizing By Stacking Context

When thinking about stacking context and how the values of each stacking context are independent of others, it sounded like other front-end solutions for effective scoping. I drew similarities to other JavaScript modules, components, atomic design, and BEM. They are all trying to solve similar problems of how we can independently scope concerns, keeping them from affecting other areas.

Taking inspiration from BEM, I made a naming convention for our constants to better organize the values and bring more order to the flat list of constants. The format I ended up using had a template like this: z<Context><Element>.

The z portion is a prefix denoting the fact that the value is meant to be used in z-index declarations, considering we had other constants defined in our JavaScript files like color variables.

The<Context> portion is replaced with the name stacking context the constant belongs to. This is similar to the “block” in BEM and in practice almost always shares the same name as the component being styled. The main exception is the root HTML stacking context that is used for page region stacking.

The final portion of the format, <Element> is for the name of the specific item to be positioned in the stacking context and is most similar to “element” in BEM.

Here is a full example of what this naming convention could look like when added to what we’ve talked about previously. For an interactive version, you can play around with the same example in a CodePen:

See the Pen Managing CSS Z-Index in Large Projects Demo by Steven Frieson.

For other language versions, check out this repository.

// Utils
const base = 0;
const above = 1; // use this for all values above the base
const below = -1; // and this for all values below the base

// Page Layout
export const zLayoutNavigation = above + base;
export const zLayoutFooter = above + base;
export const zLayoutModal = above + zLayoutNavigation;
export const zLayoutPopUpAd = above + zLayoutModal;

// NavMenu
export const zNavMenuBackdrop = below + base;
export const zNavMenuPopover = above + base;
export const zNavMenuToggle = above + zNavMenuPopover;

Now that our constants are organized by their stacking context, we can quickly see which values are related and where a new value or fix should go.

Taking It Further

That is essentially the specification of how this should work. Considering this solution was only designed with one application in mind, there are some further steps that could be taken to make it more mature and support more use cases. Some of these ideas are more specific to the language it’s being implemented in but most ideas carry over.

One area that could possibly be improved around what is being shipped to the browser. When I implemented this, the framework we were using did not give us much control over the build tools, so the JavaScript file of all the definitions was bundled with the application. This did not have a measurable performance impact on our application, but you may have noticed that all of the values could be computed at compile time. An implementation using Sass would end up not shipping any of the Sass variables to the client, but instead, insert the derived z-index value in the CSS. For JS and CSS solutions, build tools like Webpack and PostCSS, respectively, could help do the same.

The way the solution evolved as I worked on it, the z-index constants ended up all in one file. This ended up being a great way to see all of the z-index values across the application at once, making it easier to quickly glance for any possible stacking conflicts. They were also filed away with other styling constants like colors and typography, so it made sense to originally have them all defined together. As the file grew though, it started to be internally organized by stacking context as explained above. Since the stacking contexts often mapped to a component, it started feeling like each set of constants could be collocated with their component. This would bring all the normal benefits of collocation, being closer to the files they’re used in, causing less friction when needing to add, edit, and remove constants. We never refactored it, but that seems like a viable option to explore.

One additional piece has to do with ergonomics and developer experience. The constants are all exported as a flat list at the moment. The naming convention took inspiration from BEM, but Sass and JavaScript allow us to use other ways to organize our data. Sass maps or JavaScript Objects or Maps could have been used to organize the values hierarchically. If we had all the values in a z object, it could have led to shorter import statements. We could have gone further to have an object per stacking context as well leading to a usage style more like z.layout.navigation. Different tools like TypeScript could guard against making typos here, though this might be more effort than it’s worth.

Our Results

The system as spelled out was successfully implemented and deployed to our production applications. Checking back in on the objectives, we definitely got rid of the magic numbers. As far as developer ease and confidence goes, my team was able to easily add new z-index values and fix pre- and post-launch bugs without fear that the changes would introduce new bugs. On multiple occasions, we fixed bugs before they were filed.

We also were able to avoid the issue of coming across a random z-index: 9999;. Though the application had sticky headers, floating action buttons, dropdowns, modals, pop up ads, and more in the stacking context, the highest value we had was 5. Even then, no one knew it since the values were all abstracted away from us in variables.

Solving developer experience issues resulted in a z-index mini-framework, helping people make the correct decision with less effort and move more quickly.

Something else we noticed was that sometimes we were assigning a z-index when we did not necessarily need one. Since stacking contexts can be created by several different properties, declarations like position: sticky; can act in a similar manner as setting z-index: 1;. In those cases, we continued to add a constant and declaration anyway. Keeping them allowed for better consistency in the system instead of allowing there to be special cases, which would degrade confidence about whether everything was working correctly or not. Keeping the constant list complete aided in understanding the system and set us up better for rearranging the values when necessary.

What It Doesn’t Solve

Like any framework, there are parts that it doesn’t not do a good job at solving for you. Naming things is still hard, and this framework slightly exacerbates the problem by requiring that you name all of your z-index values. Even still, we found that the gained clarity overcame the chore of having to name them all.

This system also does not necessarily help you figure out which stacking context a bug is in. Coming across a z-index bug where you don’t know where the new stacking context is created or where the z-index value is set is not solved by this framework, but once you have found the issue, the path to making the correct fix is clear.

Using It In Your App

The ideas shared here should be actionable in most applications depending on your styling solution and browser support. Migrating to use this system is not very risky since stacking contexts are already scoped individually; you can migrate one context as it already exists at a time. Changing to use these conventions forces you to describe more clearly what you already have in your app, shining a light on what might currently seem like a dark, scary corner.

If your z-index values are in a state where you are unsure about most or all of them, then the best way to convert to this system will probably be to start by creating a constant for each value in a single list in a single file. As the stacking contexts become more clear, you can start grouping them and renaming them (if necessary) to conform to the naming convention.

My team was not working with any external CSS libraries or frameworks that included z-index values, but that could possibly add some difficulty to adopting this system. Hopefully, the utilities are configurable enough to deal with most uses and to even incorporate the third-party values into the system.

Finally, all of the examples here have been written as a single file of z-index values, but you could collocate these values with the component to make an even stronger connection between the two. Using a file naming convention will make it easier to find all of the values throughout the application.

Try It Out Yourself

If you are having trouble wrangling z-index values on your site and end up trying out these suggestions, I would love to hear about your experience. This mini-framework was developed over just a few months and has only been used in one production codebase, so there are certainly unexplored use cases and opinions that could be added or tweaked.

How to Add a Custom Domain Alias for Your WordPress Landing Page

Do you want to add a custom domain alias for your WordPress landing page?

Instead of installing a separate WordPress website, wouldn’t it be nice if you could use your existing WordPress to make landing pages and point different domains to specific custom landing pages?

In this article, we’ll show you how to easily add a custom domain alias for your WordPress landing page.

Adding a custom domain for your WordPress landing page

Why Add a Custom Domain for a WordPress Landing Page?

Let’s say you have a blog where you publish cooking recipes on a domain name called mycookingrecipes.com. Now you want to sell online courses on your website.

A good way to promote your online courses business would be to have its own marketing website using a different domain name (for e.g. awesomecookingcourse.com).

Now, you can make a separate WordPress website and spend your time and money on that, or you can simply add a custom domain and point it to a landing page on your existing website.

This way you can create an awesome landing page (micro-site) that is highly optimized for conversions. At the same time, you can use the same WordPress installation for creating and selling courses.

Similarly, let’s say you are launching a new product on your WooCommerce store. You want to use a custom domain to promote that product without creating a separate WooCommerce store.

This allows you to save time on website maintenance tasks while keeping your WordPress website costs under control.

Another popular use-case for this solution is marketing agencies. If you’re creating PPC landing pages for clients and managing it through a platform like Unbounce, you can now significantly reduce your bill by doing that all from a single WordPress install while still using clients’ custom domains.

That being said, let’s take a look at how to easily add a custom domain alias to your WordPress landing page.

What Do you Need to Add a Custom Domain Alias for Your WordPress Landing Page?

First, you’ll obviously need a new domain name. We recommend using Domain.com as they are one of the best domain name registrars on the market.

They have competitive pricing and you are free to use your domain name with any WordPress hosting company.

Secondly, you’ll need to make sure that your WordPress hosting company allows you to use multiple domains pointing to the same WordPress website.

Lastly, you’ll need SeedProd. It is the best WordPress page builder plugin on the market with a built-in feature to use a custom domain for any landing page on your website.

Note: You’ll need at least their Pro plan to access the domain mapping feature.

Creating Your Landing Page in WordPress

We will start by creating the landing page on your existing WordPress website.

First, install and activate the SeedProd plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit SeedProd » Settings page to enter your license key. You can find this information under your account on the SeedProd website.

SeedProd License Key

Next, you need to visit SeedProd » Pages page and then click on the ‘Add New Landing Page’ button.

Creating a new landing page

On the next screen, you’ll be asked to choose a template. SeedProd comes with several professionally designed templates that you can use as a starting point.

Choose landing page template

Simply click to select the template you want to use. You’ll be asked to provide a name for your landing page and choose a URL slug.

Choose page name and URL slug

After entering the required information, click on the ‘Save and Start Editing the Page’ button to continue.

This will launch the SeedProd’s drag and drop page builder interface.

SeedProd's page builder

The page builder is super easy to use. Simply point and click on any item on the page to edit and change it. You can also add new elements by adding blocks from the left panel.

It comes with all commonly used blocks needed to make any type of landing page. You can also add complete sections by switching to the sections tab.

Add complete sections to your landing page

There are common sections like header, footer, hero image, call to action, and more.

You can change any element on your landing page by changing its properties like fonts, size, colors, background images, and more.

Editing in SeedProd page builder

You can also connect your landing page to third-party tools by switching to the ‘Connect’ tab. SeedProd supports all top email marketing platforms, Google Analytics, and over 2000+ other apps via Zapier.

SeedProd integrations

Once you are satisfied with your landing page, you can click on the Save button to publish your landing page.

Save and publish your landing page

Adding Custom Domain to Your Landing Page

Now that your landing page is ready. Let’s tell SeedProd that this landing page will be displayed by using a custom domain alias.

To do that, you need to simply edit the page and switch to the ‘Settings’ tab. Ther you’ll find the ‘Custom Domain’ option where you need to switch the toggle to turn ON the custom domain.

Setting custom domain for your landing page

Below that, you need to provide the domain name that you want to use.

If your custom domain name has an SSL certificate enabled for it, then you need to switch the force HTTPs option as well.

Don’t forget to click on the Save button to store your changes.

If you tried visiting your landing page now, it will show you an error. That’s because SeedProd is trying to use your custom domain name, but the domain name doesn’t point to your website yet.

Let’s change that.

Setting up Custom Domain Alias

You need to point your custom domain alias to your WordPress hosting provider. You can do that by editing the DNS nameservers under your domain registrar account.

Nameservers are part of the global database of the domain name system. Their job is to tell other computers where to find a domain name.

You can find out which nameservers to use for your hosting company by asking their support team. For instance, Bluehost uses the following nameservers for most websites:

ns1.bluehost.com
ns2.bluehost.com

Once you find out the nameservers used by your hosting provider, you need to write them down as you’ll need this information in the next step.

For the sake of this tutorial, we’ll be showing you how to do that for a domain registered at Domain.com by pointing it to Bluehost. However, the basic instructions are the same for most domain registrars.

First, you need to log in to your Domain.com account. After that, you need to click on the ‘DNS & Nameservers’ link in the left-hand sidebar.

Editing DNS nameservers on Domain.com

Before you start, make sure the correct domain is selected at the top of the screen. Once you have verified the domain is correct, simply scroll down to the NS records section.

First, click the 3 vertical dots next to ns1.domain.com then select Edit.

Editing nameserver

You will see a popup where you need to edit the nameserver record. Simply type the new nameserver in the ‘Content’ box then click the ‘Update DNS’ button.

Updating nameservers

Repeat the same process for the ns2.domain.com nameserver record too. You will see your updated nameservers in the list.

Nameservers updated

For more details and other domain name registrars please see our guide on how to easily change DNS nameservers.

Adding Custom Domain to Your Hosting Account

Now that your custom domain is pointing to your WordPress hosting provider, the next step is to add it to your hosting account.

We’ll show you how to add your domain name in Bluehost. However, the process is the same for most hosting providers.

Simply login to your hosting account dashboard and then go to Domains » Assign page. Here, you need to enter the domain name that you want to add under ‘Use a domain that is not already associated with your account’.

Adding an addon domain in Bluehost

Bluehost will now check if the domain name points to their nameservers. After that, you can scroll down to ‘Addon vs Parked’ section and select ‘Addon’ option.

As an addon domain

Below that, you will be given the option to select the directory (folder) you want to use for this domain. You need to choose the directory where your WordPress site is installed.

Choose directory

If you are unsure, you can simply choose public_html option below.

Finally, click on the ‘Assign this domain’ button to add your domain name.

That’s all, you can now enter your custom domain alias in a new browser tab, and it will automatically show your WordPress landing page.

Landing page preview

We hope this article helped you point your custom domain alias to your WordPress landing page. You may also want to see our guide on how to create an email newsletter, and our comparison of the best business phone services to boost your landing page conversions.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Add a Custom Domain Alias for Your WordPress Landing Page appeared first on WPBeginner.