{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "bfc3066b",
   "metadata": {},
   "source": [
    "# 16-21 · Focus i dostępność\n",
    "\n",
    "Praktyka do sekcji [„Focus, klawiatura i podstawy dostępności”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9e1f903b",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Sprawdź formularz pod kątem podstawowych zasad dostępności."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1508dfb7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T21:45:18.430142Z",
     "iopub.status.busy": "2026-08-18T21:45:18.430025Z",
     "iopub.status.idle": "2026-08-18T21:45:18.448621Z",
     "shell.execute_reply": "2026-08-18T21:45:18.448178Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True True\n"
     ]
    }
   ],
   "source": [
    "forma = [\n",
    "    {\"name\": \"name_entry\", \"has_label\": True, \"tab_index\": 0},\n",
    "    {\"name\": \"email_entry\", \"has_label\": True, \"tab_index\": 1},\n",
    "    {\"name\": \"submit_button\", \"has_label\": True, \"tab_index\": 2},\n",
    "]\n",
    "\n",
    "def vse_imeyut_metku(widgets):\n",
    "    return all(w[\"has_label\"] for w in widgets)\n",
    "\n",
    "def poryadok_posledovatelen(widgets):\n",
    "    indeksy = [w[\"tab_index\"] for w in widgets]\n",
    "    return indeksy == sorted(indeksy)\n",
    "\n",
    "vse_s_metkami = vse_imeyut_metku(forma)\n",
    "poryadok_ok = poryadok_posledovatelen(forma)\n",
    "print(vse_s_metkami, poryadok_ok)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "44f9de05",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Znajdź problem w formularzu bez oznak w polu wyszukiwania."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "200c0193",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-18T21:45:18.449752Z",
     "iopub.status.busy": "2026-08-18T21:45:18.449644Z",
     "iopub.status.idle": "2026-08-18T21:45:18.451906Z",
     "shell.execute_reply": "2026-08-18T21:45:18.451515Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "slomannaya_forma = [\n",
    "    {\"name\": \"search_entry\", \"has_label\": False, \"tab_index\": 0},\n",
    "]\n",
    "najdena_problema = not vse_imeyut_metku(slomannaya_forma)\n",
    "print(najdena_problema)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
