-
Notifications
You must be signed in to change notification settings - Fork 376
[WIP] Added PF4 namespace to data-ouia-component-type attributes #3622
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
Conversation
|
PatternFly-React preview: https://patternfly-react-pr-3622.surge.sh |
Codecov Report
@@ Coverage Diff @@
## master #3622 +/- ##
=======================================
Coverage 67.15% 67.15%
=======================================
Files 907 907
Lines 25559 25559
Branches 2267 2267
=======================================
Hits 17165 17165
Misses 7353 7353
Partials 1041 1041
Continue to review full report at Codecov.
|
| aria-label={ariaLabel} | ||
| {...(ouiaContext.isOuia && { | ||
| 'data-ouia-component-type': 'Alert', | ||
| 'data-ouia-component-type': 'PF4/Alert', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want an issue for this to discuss the format. For example, we may want to omit the version and use something more like pf-alert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @dlabrecq . Is there a formal spec for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlabrecq What if a someday new version of Patternflywill be released let's say PF5 and some application will have to use both of them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@redallen There is a spec https://ouia.readthedocs.io/en/latest/README.html#ouia-component:
A root level HTML element with a data-ouia-component-type attribute describing a unique name identifying ALL HTML components that can be controlled with the same code or interactions. These identifiers MAY and SHOULD be namespaced when used within a framework, particularly when the name is generic. The delimiter between namespace and type name should be a single / character.
- e.g. A page that has a special dropdown could choose to name that dropdown as FrameworkA/CustomDropdown. All instances of this FrameworkA/CustomDropdown component MUST be expected to be able to be controlled via the same automation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have this for our CSS selector names, so thought to ask. I'm fine with whatever the team decides here. Just thinking the team should discuss...
| aria-label={ariaLabel} | ||
| {...(ouiaContext.isOuia && { | ||
| 'data-ouia-component-type': 'Alert', | ||
| 'data-ouia-component-type': 'PF4/Alert', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @dlabrecq . Is there a formal spec for this?
|
Updated the PR after discussion with @karelhala and @psav. Namespace should be defined in a separate attribute and be always enabled. |
packages/patternfly-4/react-core/src/components/Dropdown/DropdownWithContext.tsx
Outdated
Show resolved
Hide resolved
8eb5975 to
234d7b9
Compare
234d7b9 to
23276c0
Compare
|
@karelhala @redallen, please review |
| aria-label={ariaLabel} | ||
| {...(ouiaContext.isOuia && { | ||
| 'data-ouia-component-type': 'Alert', | ||
| 'data-ouia-component-ns': 'PF4', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be defined in one place, instead of within each component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dlabrecq it's a good point but my knowledge of typescript is limited, I believe it can be done somewhere here https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-core/src/components/withOuia/withOuia.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking we just need to import a common file. Perhaps ouia.ts or withOuia.tsx would be a good location to store the namespace?
.../packages/patternfly-4/react-core/src/components/withOuia/ouia.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance we can use a qualified URI as the namespace, instead of a basic string? Something like https://www.patternfly.org/v4 as the namespace is more semantic and readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a good article in case it is helpful
https://www.w3.org/2001/tag/doc/URNsAndRegistries-50-2006-08-17.html#args_http
|
I think the need to add a namespace has revealed our OUIA implementation has too much boilerplate. We should not be hardcoding the string 'PF4' for each OUIA component. We'll discuss the best way to implement this, which might be doing away with the |
|
Hey @karelhala , @quarckster , and @psav , our infrastructure team discussed our OUIA implementation today and we would like to ignore export function getOUIAProps(componentName, id) {
return {
'data-ouia-component-ns': 'PF4',
'data-ouia-component-type': componentName,
'data-ouia-id': id
};
}and then in components: import { getOUIAProps } from '../../helpers/getOUIAProps';
export class Alert extends React.Component {
render() {
return <div {...getOUIAProps(Alert.displayName, props.ouiaID)} />
}
}However, we would like to time this with our breaking change release since it changes the way components are rendered in snapshots. Is this a pressing issue, or can we wait until our breaking change release? Who do we expect to modify the current outstanding PRs after this change? |
|
@redallen Let's wait for the breaking change release. After that this PR should be closed and new issue and PR should be created. I will take over it. |
|
Closing in favor of #3927. |
In order to distinguish similar components from different libraries
data-ouia-component-typeattribute should have namespaces.Fixes #3626