Archive: May 2024

  • What questions to ask in an interview with a PM | Hindustan Times

    In this piece, Karan Thapar emphasizes that:

    • Interviewers must remember they are asking questions on behalf of the public.
    • Questions must be relevant, significant, and timely to demand accountability.
    • The interviewer must persistently push for answers instead of allowing monologues or tangents.
    • The interview should not serve as a platform to attack critics, but rather an occasion to make the PM respond to valid criticisms.
    • The interviewer and PM must interact as equals, with the former feeling empowered to challenge evasions or dubious claims.
  • Digging Into The Display Property: The Two Values Of Display — Smashing Magazine

    In Level 3 of the Display specification, the value of display is defined as two keywords. These keywords define the outer value of display, which will be inline or block and therefore define how the element behaves in the layout alongside other elements. They also define the inner value of the element — or how the direct children of that element behave.

    This means that when you say display: grid, what you are really saying is display: block grid. You are asking for a block level grid container. An element that will have all of the block attributes — you can give it height and width, margin and padding, and it will stretch to fill the container. The children of that container, however, have been given the inner value of grid so they become grid items. How those grid items behave is defined in the CSS Grid Specification: the display spec gives us a way to tell the browser that this is the layout method we want to use.

    As simply put by Rachel:

    When you define layout on a box in CSS, you are defining what happens to this box in terms of how it behaves in relation to all of the other boxes in the layout. You are also defining how the children of that box behave.

  • Transparent borders

    In web development, small design decisions can have a significant impact on accessibility and user experience. One such decision is how we handle borders on interactive elements.

    The problem with border: none

    When styling interactive elements like buttons, it’s common practice to remove default borders using border: none. However, this approach can lead to accessibility issues, especially in high contrast mode. As demonstrated in the image below, removing the border entirely can cause buttons to appear as floating text on the page, making it difficult for users with low vision to distinguish interactive elements.

    Side-by-side comparison of the contact form on Slae.app. The left image shows the contact form with forced colors disabled, displaying the default color scheme. The right image shows the contact form with forced colors enabled. In the right image, the submit button appears as floating text on the page.

    Dave Rupert explains the importance of the default border and why it exists:

    In the case of interactive form controls (inputs, textareas, buttons, etc.), those pesky borders were put there because they have an accessibility benefit when using High Contrast Mode, a feature used by 30.6% of low-vision users.

    The transparent border solution

    To address this issue, Dave recommends making the border or outline transparent instead of removing it entirely. This can be achieved with the following CSS:

    button {
    	border-color: transparent;
    }

    As demonstrated in the image below, this approach is effective for several reasons. First, sighted users will not notice the difference. Second, as Kilian Valkhof explains, in forced color mode, the border color or outline color “will be overwritten with the current text color, making it nicely visible again without needing any special adaption or re-styling for forced color mode.”

    Side-by-side comparison of the contact form on Slae.app with the transparent border solution applied. The left image shows the contact form with forced colors disabled, displaying the default color scheme. The right image shows the contact form with forced colors enabled. In the right image, the submit button appears as a button.

    User experience benefits

    Using transparent borders offers additional benefits for user experience. Consider hover effects, for example.

    button {
    	border: none;
    }
    
    button:hover {
    	border: 2px solid navy;
    }

    In such situations, applying a visible border on hover can inadvertently change the element’s dimensions. This change in size can result in a jarring visual effect.

    By setting a transparent border in the default state, we ensure smooth transitions and consistent element sizes across different states.

    <div>
    	<button class="no-border-btn">Button with no border</button>
    	<button class="transparent-border-btn">Button with transparent border</button>
    </div>
    .no-border-btn {
    	border: none;
    
    	&:hover {
    		border: 2px solid navy;
    	}
    }
    
    .transparent-border-btn {
    	border: 2px solid transparent;
    
    	&:hover {
    		border-color: navy;
    	}
    }

    Implications for design systems

    Transparent borders are also valuable in the context of themeable design systems. Brad Frost elaborates:

    When supporting multiple theme, it can be common for some themes to use borders while others don’t. This flexibility is great! Each brand is able to express themselves how they see fit. But if implemented using different border widths, shifts in the box model happen.

    By using border-color: transparent for themes without visible borders, designers and developers can maintain consistent element sizes across different variants and themes. This approach provides the flexibility to adapt the visual design while preserving the underlying structure and layout of the components.

    Conclusion

    Implementing transparent borders in your CSS addresses crucial accessibility concerns, enhances user experience across different display modes, and provides the flexibility needed for robust, adaptable design systems.

  • Embrace the Platform – Bram.us

    If there’s one thing you can do to make your websites better, it is to embrace what the web platform gives you: HTML, CSS, and JavaScript — in that order. Apply the Rule of Least Power. Build with progressive enhancement in mind. You’ll be a happier developer. Your visitors will be happier, too, as things work as expected.