backstage / backstage

Backstage is an open framework for building developer portals
https://backstage.io/
Apache License 2.0
26.9k stars 5.58k forks source link

šŸ› Bug Report: Links in mardown description content do not open in new tab #24753

Closed erik-adsk closed 1 month ago

erik-adsk commented 1 month ago

šŸ“œ Description

When links are included in a template yaml definition these are not opened in a new tab. There is precedence for this being the intent of the application in github issue #9146. The related PR #9148 provided a linkTarget property that can be passed in.

šŸ‘ Expected behavior

A github flavored markdown link provided in the description of a scaffolder field should open in a new tab.

šŸ‘Ž Actual Behavior with Screenshots

The link is actually opened in the current tab.

image

image

šŸ‘Ÿ Reproduction steps

  1. Create a local-template file local-template.yaml in the plugins/scaffolder-backend/sample-templates folder e.g.
    
    apiVersion: scaffolder.backstage.io/v1beta3
    kind: Template
    metadata:
    name: test-form
    title: Test Form
    description: This is a test form
    spec:
    owner: guest@example.com
    type: test
    parameters:
    - title: Provide some simple information
      properties:
        prop:
          title: A property with links
          type: string
          description: 'A github flavored markdown formatted [link](https://www.google.com) in the description'
    steps:
    - id: debug
      name: debug
      action: debug:log
      input:
        message: message
    output:
    links:
    - title: Google
      url: https://www.google.com/

2. Add `    - ./local-template.yaml` to as defined in [plugins/scaffolder-backend/sample-templates/all-templates.yaml](https://github.com/backstage/backstage/blob/master/plugins/scaffolder-backend/sample-templates/all-templates.yaml)
3. Run the application locally
4. Route or navigate to http://localhost:3000/create
5. Choose the created form e.g. http://localhost:3000/create/templates/default/test-form
6. Select the github formatted link
7. Observe the link is opened in the current tab

### šŸ“ƒ Provide the context for the Bug.

When a user clicks a link in the markdown of the description of a template field the link is opened in the current tab.  This causes users to lose progress on current template submissions which is especially frustrating for multi-step templates.

### šŸ–„ļø Your Environment

OS:   Windows_NT 10.0.19045 - win32/x64
node: v18.20.0
yarn: 3.8.1
cli:  0.26.5-next.1 (local)
backstage:  N/A

### šŸ‘€ Have you spent some time to check if this bug has been raised before?

- [X] I checked and didn't find similar issue

### šŸ¢ Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/backstage/backstage/blob/master/CODE_OF_CONDUCT.md)

### Are you willing to submit PR?

Yes I am willing to submit a PR!