Skip to content

perf(context-menu): register global pointer listeners only while open - #4635

Merged
Y-PLONI merged 3 commits into
devfrom
palmoni5/context-menu-open-only-global-route-20261108
Nov 9, 2026
Merged

Y-PLONI merged 3 commits into
devfrom
palmoni5/context-menu-open-only-global-route-20261108

Conversation

@palmoni5

@palmoni5 palmoni5 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Problem

Every focusable AppSubmenuButton registered a global pointer route when built, even when its submenu was closed. Large popup menus containing many submenu rows therefore executed O(N) per-pointer listener dispatch and checks across the application.

Change

Track the global pointer route only while the particular focusable submenu is open. Remove it on close, focus-policy switch and widget disposal; retain it when a replacement controller takes over an open submenu. Focus-preserving context submenus continue to register no route.

Regression coverage

Update the existing lifecycle test and add a 40-submenu test asserting zero routes while closed, one while the selected submenu is open, and no residual routes after close/disposal. Existing pointer exit behavior and focus tests remain in the package.

תיקון הרגרסיות ואימות

החלפת controller משמרת את מעקב העכבר של התפריט הפתוח, כי ה־anchor נשמר ומתחבר לבקר החדש. שינוי preserveFocus מסיר את המעקב, כי החלפת מעטפת ה־FocusScope יוצרת anchor חדש וסגור. נוספו 14 תרחישי בדיקה למחזור החיים, כולל החלפת בקר, שני כיווני שינוי המדיניות, טיימר סגירה ממתין, dispose וריקון ילדים. שלושה תרחישים נכשלו לפני התיקון ועברו אחריו.

לאחר rebase על dev@6379362d9b5d9f4cdf0218b37a72af024bc7c4c1: ניתוח נקי; 78 בדיקות החבילה שב־git ו־117 בדיקות שילוב תפריטים עברו. שני תרחישי שחזור מקומיים נוספים עברו. בדיקות השילוב השתמשו בדילוג זמני על בניית מנוע נייטיבי שאינו קשור לתפריטים; קובצי pubspec וה־lockfile הוחזרו ללא שינוי. סקירת קוד עצמאית נוספת של Luna הסתיימה ללא ממצאים חוסמים. CI עדיין בתור בעת האימות; לא המתנו לו.

בדיקת חפיפות מלאה: #4269 ו־#4525 נוגעים בקובצי חבילה אחרים, ללא חפיפה ב־submenu_button.dart.

@palmoni5
palmoni5 marked this pull request as ready for review November 8, 2026 23:11
@Y-PLONI
Y-PLONI force-pushed the palmoni5/context-menu-open-only-global-route-20261108 branch from c89cdd0 to fcea9df Compare November 9, 2026 13:56
@Y-PLONI
Y-PLONI force-pushed the palmoni5/context-menu-open-only-global-route-20261108 branch from fcea9df to f17bcf0 Compare November 9, 2026 18:43
@Y-PLONI
Y-PLONI merged commit 5a46143 into dev Nov 9, 2026
@Y-PLONI
Y-PLONI deleted the palmoni5/context-menu-open-only-global-route-20261108 branch November 9, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants