Thuta Learning
ရှာဖွေရန်
AdvancedWeb Developmentintermediate

Performance နှင့် Accessibility

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Client bundle ကို သေးအောင်စဉ်းစားရန်
  • Core Web Vitals အပေါ်သက်ရောက်မှုကို သိရန်
  • Keyboard နှင့် screen reader အသုံးပြုသူများကို ထည့်စဉ်းစားရန်

ကိုယ့် laptop နဲ့ Wi‑Fi ကောင်းကောင်းပေါ်မှာ မြန်တာတစ်ခုတည်း မလုံလောက်ပါဘူး။ ဖုန်းအဟောင်း၊ network နှေးတဲ့ user နဲ့ mouse မသုံးနိုင်တဲ့သူကိုပါ စဉ်းစားမှ production app ဖြစ်ပါတယ်။

နားလည်ထားရမယ့် အချက်

Server Component ကို default ထားပြီး interactive leaf ကိုသာ Client Component လုပ်တာက JavaScript လျှော့တဲ့အကောင်းဆုံးအစဖြစ်ပါတယ်။ next/image၊ next/font၊ route code splitting နဲ့ streaming ကိုသုံးပါ။ Semantic heading order၊ label ပါသော form၊ button အစစ်၊ visible focus၊ လုံလောက်သော color contrast နဲ့ keyboard navigation ကိုစစ်ပါ။ Performance တိုင်းတာမှုကို Lighthouse တစ်ခုတည်းမယုံဘဲ production field data နဲ့ Core Web Vitals ကိုလည်းကြည့်ပါ။

အတူတူ စမ်းရေးကြည့်မယ်

tsx
"use client";
import { useState } from "react";

export function SaveButton() {
  const [status, setStatus] = useState("idle");
  return (
    <div>
      <button type="button" onClick={() => setStatus("saved")}>
        မှတ်စုသိမ်းမယ်
      </button>
      <p aria-live="polite">
        {status === "saved" ? "သိမ်းပြီးပါပြီ" : ""}
      </p>
    </div>
  );
}

Code က ဘယ်လိုအလုပ်လုပ်သလဲ

Button က div onClick မဟုတ်ဘဲ HTML button ဖြစ်လို့ keyboard၊ focus နဲ့ screen reader behavior အခြေခံရပါတယ်။ aria-live က save status ပြောင်းတာကို screen reader သို့အသိပေးပါတယ်။

You should see
Mouse နှင့် keyboard နှစ်မျိုးလုံးသုံးနိုင်ပြီး save status ကို assistive technology သိနိုင်မည်။

၅ မိနစ် စမ်းကြည့်

မိမိ homepage ကို keyboard တစ်ခုတည်းနဲ့သွားလာပြီး focus မမြင်ရသောနေရာ၊ label မရှိသော input နဲ့ heading order ကို ပြင်ပါ။

Next.js — Production ChecklistNext.js

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Clickable div ကို button အဖြစ်သုံးခြင်း
  • Lighthouse score 100 ရရုံနဲ့ user experience အားလုံးကောင်းပြီဟု ယူဆခြင်း

လေ့ကျင့်ခန်း

မိမိ homepage ကို keyboard တစ်ခုတည်းနဲ့သွားလာပြီး focus မမြင်ရသောနေရာ၊ label မရှိသော input နဲ့ heading order ကို ပြင်ပါ။

You'll know it worked when: Mouse နှင့် keyboard နှစ်မျိုးလုံးသုံးနိုင်ပြီး save status ကို assistive technology သိနိုင်မည်။

Performance နှင့် Accessibility | Thuta Learning