Saturday, June 20, 2026

CSS focus ring

 The CSS focus ring is the visual indicator (usually a blue or dotted outline) that appears around interactive elements like links, buttons, and inputs when they are focused via keyboard navigation (like pressing the Tab key).


It is a critical feature for accessibility (a11y), allowing users who don't use a mouse to see exactly where they are on a page.


The CSS Focus Pseudo-Classes

To style the focus ring, you will primarily use three pseudo-classes depending on how you want the ring to behave:


:focus: Applies whenever an element receives focus, whether by keyboard, mouse click, or touch. (Can look messy when mouse users click a button and get a big ring).


:focus-visible: The modern standard. It only applies the focus ring when the browser determines it’s helpful—typically only for keyboard users, leaving mouse users with a clean interface.


:focus-within: Applies to a parent element when any of its child elements gain focus.


How to Style the Focus Ring

Historically, developers used outline, but modern CSS gives us much better control using outline, box-shadow, and outline-offset.


1. The Modern Standard (:focus-visible)

Use this for 95% of your use cases to keep things accessible for keyboard users without annoying mouse users.


CSS

/* Target buttons and links when focused via keyboard */

button:focus-visible, 

a:focus-visible {

  outline: 3px solid #3b82f6; /* Thicker, vibrant blue ring */

  outline-offset: 2px;       /* Pushes the ring away from the element */

}

2. The Custom Glow Effect (box-shadow)

If you want a smoother, curved focus ring that matches an element's border-radius, box-shadow is excellent. Note that you should always pair it with a transparent outline so users with Windows High Contrast Mode can still see it.


CSS

input:focus-visible {

  outline: 2px solid transparent; /* Fallback for high-contrast accessibility */

  border-color: #3b82f6;

  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.5); /* Soft outer glow */

}

3. Styling the Parent (:focus-within)

Great for form cards or search bars where you want the entire container to light up when the input inside is active.


CSS

.search-form-container:focus-within {

  border-color: #10b981;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

}

The Golden Rule: Never Just outline: none

⚠️ Accessibility Warning: Never use outline: none or outline: 0 without immediately providing a custom, highly visible focus alternative. Removing the focus ring entirely breaks website navigation for millions of keyboard and assistive technology users.


If you hate how the default focus ring looks on mouse clicks, don't kill it completely. Just use :focus-visible instead:


CSS

/* Bad: Breaks accessibility completely */

button:focus {

  outline: none;

}


/* Good: Removes default for mouse, keeps/customizes for keyboard */

button:focus {

  outline: none; /* Reset default */

}

button:focus-visible {

  outline: 3px solid #ff4757; /* Custom keyboard focus */

}

Cheers

Samitha

Friday, June 5, 2026

Best way to crop image without losing quality

 Cropping itself does NOT reduce quality — it simply removes unwanted pixels. [wildandfreetools.com]

Quality loss usually happens because of:

  1. Saving as low‑quality JPG
  2. Re-compressing multiple times
  3. Resizing after cropping [picovert.com]


Recommended steps

  • Upload your image to a crop tool
  • Drag the crop box to exclude the right side (text)
  • DON’T resize unless needed
  • Export with: PNG (best quality, lossless) OR JPG at 90–100% quality [fixtools.io]


Best FREE online crop tools (no quality loss)

Here are reliable ones:

1. Adobe Express Crop Tool

Easy drag-and-drop cropping

Keeps high quality

No signup needed

https://www.adobe.com/express/feature/image/crop [adobe.com]


2. FixTools (Lossless crop)

True lossless cropping

Lets you control export quality precisely

 https://www.fixtools.io/image-tools/crop-image-without-losing-quality [fixtools.io]


 3. FastConvert Crop Tool

Supports custom dimensions (good for your unusual size)

No registration required

 https://fastconvert.co/crop-image [fastconvert.co]


4. FormatFuse Cropper

Pixel-accurate cropping

Keeps original format (lossless for PNG)

https://formatfuse.com/tools/image-crop [formatfuse.com]


5. ArtsFlick Crop Tool

Designed to crop without blur or compression

 https://artsflick.com/features/crop [artsflick.com]


For UI banners or screenshots:

Always use PNG (text remains sharp)


Cheers

Samith

Saturday, May 9, 2026

Using Helvetica Neue font

 Adding Helvetica Neue to your CSS is a classic choice for a clean, modern look. However, because it is a licensed font owned by Monotype, it isn't "free" to host like a Google Font. You have to handle it differently depending on whether you're relying on the user's system or hosting the files yourself.1. The "System Font" Method (Recommended)This is the fastest and most common way. Since Helvetica Neue comes pre-installed on almost all Macs and iOS devices, you can simply call it in your font stack. If the user doesn't have it (like on most Windows or Android devices), the browser will fall back to the next font in your list.CSS.your-class {

  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;

}

Why this order? The browser reads left-to-right. It tries to find "Helvetica Neue" first. If that fails, it looks for "Helvetica," then "Arial," and finally any generic "sans-serif" font.2. Using @font-face (Self-Hosting)If you have purchased a web license and have the font files (e.g., .woff2 or .woff), you can host them on your own server. This ensures the font appears on all devices, even Windows.Upload the font files to your project folder (e.g., /fonts/).Define the font in your CSS:CSS@font-face {

  font-family: 'Helvetica Neue';

  src: url('fonts/helvetica-neue-bold.woff2') format('woff2'),

       url('fonts/helvetica-neue-bold.woff') format('woff');

  font-weight: bold;

  font-style: normal;

}


body {

  font-family: 'Helvetica Neue', Arial, sans-serif;

}



Cheers
Samitha

Sunday, May 3, 2026

Package 'MailKit' 4.7.1.1 has a known moderate severity vulnerability,

 Warning As Error: Package 'MailKit' 4.7.1.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-9j88-vvj5-vhgr


The error message you're seeing is a security safeguard. Because your project is likely configured with TreatWarningsAsErrors enabled, NuGet is blocking your build due to a known security vulnerability in MailKit 4.7.1.1.


The Vulnerability: GHSA-9j88-vvj5-vhgr

This is a STARTTLS Response Injection vulnerability.

The Risk: A Man-in-the-Middle (MitM) attacker can inject commands during the "handshake" phase when your app switches from a plain-text connection to an encrypted one (TLS).

The Impact: This can be used to trick your application into "downgrading" its security—for example, forcing it to use a less secure authentication method (like sending passwords in plain text) even though you think you're using an encrypted connection.

How to Fix It

The fix is straightforward: Upgrade MailKit to a patched version.

1. Update via .NET CLI

Run the following command in your terminal at the project root:

Bash

dotnet add package MailKit --version 4.8.0

(Or the latest available version, as 4.8.0+ contains the fix).

2. Update via Package Manager Console (Visual Studio)

PowerShell

Update-Package MailKit

3. Update via Project File (.csproj)

Locate the PackageReference in your .csproj file and update the version manually:

XML

<PackageReference Include="MailKit" Version="4.8.0" />

Why am I seeing this now?

The .NET SDK and NuGet now integrate with the GitHub Advisory Database. When you build your project, it checks your dependencies against known security threats.

If you absolutely cannot upgrade right now (which is not recommended) and need to bypass the error to unblock your build, you can temporarily "suppress" this specific warning by adding the following to your .csproj file, though you should only do this if you have a specific mitigation in place:


XML

<PropertyGroup>

  <NoWarn>$(NoWarn);NU1901;NU1902;NU1903;NU1904</NoWarn>

</PropertyGroup>

Recommendation: Stick with the upgrade. MailKit updates are generally very stable and backward-compatible within the same major version

Sunday, April 26, 2026

Converting an AI (Adobe Illustrator) file to a PNG

 Converting an AI (Adobe Illustrator) file to a PNG is a common task when you need to turn a scalable vector graphic into a web-ready, transparent raster image.


Since AI files are "vector-based" (made of paths) and PNGs are "raster-based" (made of pixels), the process involves a step called rasterization. Here are the best ways to do it depending on the tools you have.


1. Using Adobe Illustrator (Best Quality)

If you have the original software, this is the most reliable method because it gives you control over resolution and transparency.


Export for Screens (Quickest): Go to File > Export > Export for Screens. Select PNG as the format and choose your "Scale" (e.g., 1x, 2x, or 300 ppi for high quality).


Export As: Go to File > Export > Export As.... Choose PNG from the dropdown menu.


Note: In the "PNG Options" pop-up, ensure the Background Color is set to Transparent if you don't want a solid white box around your logo.


2. Using Free Online Converters (No Software Needed)

If you don't have Illustrator, several web-based tools can handle the conversion for you. These are great for one-off tasks.


CloudConvert: Very reliable and maintains high fidelity.


Adobe Express: Adobe offers a free online converter that is specifically optimized for their own file formats.


Zamzar: A classic choice for simple file-to-file swaps.


 Cheers

Samitha

Sunday, April 19, 2026

npm run dev command does not load Vue JS UI

 It is incredibly frustrating when the terminal says "Ready" and the browser opens, but all you get is a blank white screen. It usually feels like the app is "running" but just refusing to speak to you.

Since `npm run dev` is technically working (it opens the link), the issue is almost certainly a **client-side JavaScript error** preventing the Vue instance from mounting.

Here is how to track down the culprit


### 1. The "Golden Rule": Check the Console

Right-click the blank page in your browser and select **Inspect**, then go to the **Console** tab.

* **Red Errors:** If you see `Uncaught ReferenceError` or `Failed to fetch dynamically imported module`, it means your code has a syntax or path error that is crashing the app before it can render.

* **404 Errors:** If it says `app.js` or `main.js` was not found, your build tool (Vite or Webpack) is looking in the wrong directory.


### 2. Common Culprits & Fixes

| Problem | Likely Cause | Solution |

| **Blank Page + No Errors** | Missing `<div id="app"></div>` | Ensure your `index.html` has a div with the ID that matches your `main.js` mount point: `app.mount('#app')`. |

| **Vite "Missing" Files** | `base` path config | If you recently changed your `vite.config.js`, ensure the `base` property is correct (usually `'/'`). |

| **Infinite Redirects** | Vue Router Guard | If you have a router guard (`router.beforeEach`) that isn't calling `next()`, the UI will never load. |

| **Case Sensitivity** | Import Filenames | On some systems, importing `./components/Header.vue` as `./components/header.vue` will fail silently or crash the build. |

### 3. Clear the "Gunk"

Sometimes the local cache gets corrupted. Try this "reset" sequence:

1.  **Stop** the terminal process (`Ctrl + C`).

2.  **Delete** the `node_modules` folder and `package-lock.json`.

3.  **Delete** the `.vite` folder (usually found inside `node_modules/.vite`).

4.  Run `npm install`.

5.  Run `npm run dev` again.


### 4. Check your `App.vue`

If you recently added a new library or a complex component, comment out the contents of your `App.vue` and replace it with a simple `<h1>Hello World</h1>`. 

* **If "Hello World" appears:** The issue is inside your components (likely a lifecycle hook like `onMounted` that is looping or crashing).

* **If it stays blank:** The issue is in your `main.js` or `index.html` configuration.


> **Quick Tip:** Check your terminal output again. Are there any **Warnings**? Sometimes Vite will continue to serve the app even if a dependency is missing, but the browser won't be able to execute the broken code.


If all of the above options does not work  check what you see in the Browser Console (F12) when the page loads. 


Cheers

Samitha

Sunday, April 5, 2026

C# 15 powerful features

1. Collection Expression Arguments

You can now pass arguments directly to a collection's underlying constructor or factory method using the with(...) syntax. This must be the first element inside the collection expression brackets [...].

  • Purpose: Allows you to set initial properties like capacity or comparers without reverting to traditional new syntax.

  • Syntax: [with(arguments), ...elements]

Examples

  • Set Capacity         
List<string> names = [with(capacity: 10), "A", "B"];

  • Set Comparer
HashSet<string> set = [with(StringComparer.Ordinal), "a", "A"];

2. Union Types

Union types allow a single variable to hold one of several specific "case types." This is a major step forward for type safety and functional programming patterns in C#.

  • Declaration: Use the union keyword followed by the allowed types: public union Pet(Cat, Dog, Bird);

  • Key Features:

    • Implicit Conversion: You can assign a Dog directly to a Pet variable without casting.

    • Exhaustive Switching: The compiler checks your switch expressions to ensure every possible case of the union is handled. If you miss a type, you get a compiler error.

  • Current Status: Introduced in .NET 11 previews. Some advanced features (like union member providers) are still in development.

Comparison: Traditional vs. New Syntax

Before (Collection Initializers):

var set = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Hi" };

After (Collection Expressions):

HashSet<string> set = [with(StringComparer.OrdinalIgnoreCase), "Hi"];


Cheers
Samitha