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

Enable dynamic hostname support #243

Open
blackfalcon opened this issue Jan 8, 2025 · 2 comments · May be fixed by #244
Open

Enable dynamic hostname support #243

blackfalcon opened this issue Jan 8, 2025 · 2 comments · May be fixed by #244
Assignees

Comments

@blackfalcon
Copy link
Member

blackfalcon commented Jan 8, 2025

Is your feature request related to a problem? Please describe.

The issue of URL routing has been discussed in the multi-branding strategy. The issue is related to the fact that multiple links within AS.com are hard-routed to www.alaskaair.com

Describe the solution you'd like

Currently, when a user of auro-hyperlink adds a href to the UI, it's not simply passed through to the internal <a> element, but it is run through a series of functions to ensure that the URL is written correctly to meet web security standards.

We can leverage this to dynamically look for the page's hostname. Instead of hard-coding the inserted hostname as we currently do, this would be more aware of the hostname of the page be it alaskaair.com or hawaiian.com, and on page render update the href to be the correct domain.

This update would also address many issues that teams have about testing code on lower QA environments where links are being hard-coded to AS.com and when tests are run, the test leaves the QA environment and causes issues with the tests.

Looking at the current footer, for example, some links look like this:

<auro-hyperlink ondark="true" href="https://www.alaskaair.com/content/about-us" type="nav" external="false">Who we are</auro-hyperlink>

That will have this code in the shadow DOM:

<a part="link" class=" hyperlink hyperlink--nav hyperlink--ondark " href="https://www.alaskaair.com/content/about-us"><slot>Who we are</slot></a>

With this update, authors would not have to update their href code, but on the fly, the https://www.alaskaair.com/ would be converted to be hawaiian.com and the shadow DOM href would look like this.

<a part="link" class=" hyperlink hyperlink--nav hyperlink--ondark " href="https://www.hawaiian.com/content/about-us"><slot>Who we are</slot></a>

Describe alternatives you've considered

Asking all teams to manually update their HREF code.

Additional context

There is another feature request that should be considered be done at the same time.

Exit criteria

  1. Dynamic Hostname Resolution:

    • auro-hyperlink dynamically updates href based on the page’s hostname (alaskaair.com, hawaiian.com, etc.).
  2. Shadow DOM Updates:

    • Shadow DOM reflects the updated href correctly for all domains.
  3. Web Security Compliance:

    • All URLs meet web security standards after updates.
  4. QA Environment Compatibility:

    • Links resolve correctly in QA environments without breaking tests.
  5. Backward Compatibility:

    • Existing auro-hyperlink implementations require no manual updates.
  6. Documentation & Testing:

    • Updated documentation and passing tests (unit, integration, and end-to-end) for all scenarios.
  7. Cross-Team Coordination:

    • Dependencies, including issue #241, are resolved.
  8. Deployment:

    • Feature deployed and validated in production with no issues.
@blackfalcon blackfalcon added Type: Feature New Feature auro-hyperlink not-reviewed Issue has not been reviewed by Auro team members labels Jan 8, 2025
@blackfalcon blackfalcon self-assigned this Jan 8, 2025
@blackfalcon
Copy link
Member Author

In prior discussions with Auro leadership, it was pre-determined that @blackfalcon would innersource this update.

@blackfalcon
Copy link
Member Author

@Patrick-Daly-AA Patrick-Daly-AA removed their assignment Jan 9, 2025
@Patrick-Daly-AA Patrick-Daly-AA removed the not-reviewed Issue has not been reviewed by Auro team members label Jan 9, 2025
@blackfalcon blackfalcon linked a pull request Jan 15, 2025 that will close this issue
6 tasks
@blackfalcon blackfalcon linked a pull request Jan 15, 2025 that will close this issue
6 tasks
blackfalcon added a commit that referenced this issue Jan 15, 2025
The default behavior now dynamically adjusts a URL's `hostname` to
match the current page if the `origin` attribute is not specified,
as the new default for `origin` is `dynamic`. Previously, URLs
relied solely on the `hostname` defined in the `href` attribute,
but with this change, links will adapt to the environment
(e.g., development, staging, or production).

The purpose of this update was to allow for dynamic resetting of
absolute HREFs when links are intended to work within the new
multi-theme experiences.

On branch dsande/dynamichostname/243
Changes to be committed:
modified:   src/auro-hyperlink.js
modified:   src/component-base.mjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants