Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroller: Add click() feature #241

Open
9 of 13 tasks
Tracked by #232 ...
nexushoratio opened this issue Feb 4, 2024 · 0 comments
Open
9 of 13 tasks
Tracked by #232 ...

Scroller: Add click() feature #241

nexushoratio opened this issue Feb 4, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request library For libraries linkedin-tool For the LinkedIn Tool userscript

Comments

@nexushoratio
Copy link
Owner

nexushoratio commented Feb 4, 2024

When working on the focus UX change, we discovered that focusOnElement() is broken by design. When an element that does not generally support focus (e.g., <div>) is used, and tabindex is taken away, focus goes back to document.body. Though, depending on browser, TAB to the next field will work as expected.

A common Shortcut is to somehow select the current item, often using Enter. After much exploring, it would probably work like:

if ([document.body, scroller.item].includes(document.activeElement) {
  handleLocally();
} else {
  document.activeElement.click();
}

In some cases, handleLocally() would be a call to clickElement(), sometimes with matchSelf = True, sometimes not. In one, it is a complicated function that depends on context.

In all cases, if unable to find something to click, postInfoAboutElement() is called.

Not yet clear if should just always be a function (like uidCallback) that returns an element, or a selector list/matchSelf object that would get passed to clickElement(), or support both. Would probably end up being both.

  • Bare click() method as initial placeholder
  • Enhance Scroller~How with click config property, default null
  • Add feature flag and add to all current users of Enter
  • In click():
    • if no current item, call document.activeElement.click()
    • config === null, call NH.base.issues.post() about programming error
    • If is a function, takes HTMLElement, returns {?HTMLElement}, if null, call postInfoAboutElement(item)
    • If object, call clickElement() with selectors and matchSelf value, if returns false, call postInfoAboutElement(item)
    • Make clickConfig (ClickConfig|ElementFinder) be consistent with how base/selectors vs containerItems are handled
  • Update existing Enter
    • MyNetwork.viewItem
    • Jobs.activateJob (rename viewJob ?)
    • Notifications.activateNotification (rename viewNotification? No, because it may cause a message pop-up)

Issue #232 can be used to decide about utilizing this else where.

@nexushoratio nexushoratio added enhancement New feature or request linkedin-tool For the LinkedIn Tool userscript library For libraries labels Feb 4, 2024
@nexushoratio nexushoratio self-assigned this Feb 4, 2024
nexushoratio pushed a commit that referenced this issue Feb 8, 2024
nexushoratio pushed a commit that referenced this issue Feb 12, 2024
nexushoratio pushed a commit that referenced this issue Feb 16, 2024
Makes it a little bit easier to read.  E.g., for "Events events" was...

Issue #241.

␄
nexushoratio pushed a commit that referenced this issue Feb 18, 2024
nexushoratio pushed a commit that referenced this issue Feb 23, 2024
nexushoratio pushed a commit that referenced this issue Feb 25, 2024
nexushoratio pushed a commit that referenced this issue Feb 26, 2024
nexushoratio pushed a commit that referenced this issue Feb 26, 2024
nexushoratio pushed a commit that referenced this issue Mar 4, 2024
Was getting a bit long.

Issue #241.

␄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request library For libraries linkedin-tool For the LinkedIn Tool userscript
Projects
None yet
Development

No branches or pull requests

1 participant